diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/osb/bitmov.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/osb/bitmov.x')
-rw-r--r-- | sys/osb/bitmov.x | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sys/osb/bitmov.x b/sys/osb/bitmov.x new file mode 100644 index 00000000..f6784b2a --- /dev/null +++ b/sys/osb/bitmov.x @@ -0,0 +1,30 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <mach.h> + +# BITMOV -- Move a sequence of bits in a bit array of arbitrary length. + +procedure bitmov (a, a_off, b, b_off, nbits) + +int a[ARB] # input bit array +int a_off # first bit to be moved +int b[ARB] # output bit array +int b_off # first bit to be written +int nbits # number of bits to be moved + +int ip, op, ip_top, nbits_left +int bitupk() + +begin + ip_top = a_off + nbits - NBITS_INT + op = b_off + + for (ip = a_off; ip <= ip_top; ip = ip + NBITS_INT) { + call bitpak (bitupk(a,ip,NBITS_INT), b, op, NBITS_INT) + op = op + NBITS_INT + } + + nbits_left = (a_off + nbits) - ip + if (nbits_left > 0) + call bitpak (bitupk(a,ip,nbits_left), b, op, nbits_left) +end |