Convert to binary array and back (or any other base) by using #. and #: as you say. Then use dyad: Shift (x |.!.f y) to shift the entries of y by the number of positions x. Operand f is the "fill atom" you want to use, f=0 if you want to fill vacated positions with 0s.
See Nuvoc: Rotate/Shift: http://www.jsoftware.com/jwiki/Vocabulary/bardot#dyadicfit On Sat, Jan 31, 2015 at 2:30 PM, Jon Hough <[email protected]> wrote: > It seems in J I cannot use the bitshift operator > shift =: 33 b. > on integers larger than 32 bit unsigned integers (i.e. 2^31). > > e.g. 1 shift (<: 2^31) has a result > but > 1 shift 2^31 > gives a domain error. > > Is there anyway to perform bitshifting operations on large (extended ?) > integers in J? > One possible, although I suppose slow, way is to truncate the binary > representation of the integer > (i.e. after using #:) and append zeros on the end. > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
