From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- sys/osb/bitmov.x | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 sys/osb/bitmov.x (limited to 'sys/osb/bitmov.x') 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 + +# 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 -- cgit