Using GMP for BigIntegers.

Per Bothner per@bothner.com
Tue Jan 30 15:24:00 GMT 2001


"Mark J. Roberts" <mjr@statesmean.com> writes:
> You use Java's unsigned right shift operator (>>> and >>>=) about 12 times
> in your code. How should I translate this to C++?

You can use a regular shift, as long as the operand is unsigned.
You can cast the operand, if need be. (Make sure that >> in the
Java code is also signed shift or that it doesn't matter.)
> Also,
> rshift (jintArray idest, jintArray ix, jint x_start, jint len, jint count)
> and
> lshift (jintArray idest, jint d_offset, jintArray ix, jint len, jint count)
> don't have GMP counterparts AFAIK.

Use pointer addition:
mpn_rshift(elements(idest), elements(ix)+x_start, len, count)
mpn_lshift(elements(idest)+d_offset, elements(ix), len, count)
-- 
	--Per Bothner
per@bothner.com http://www.bothner.com/~per/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /