aboutsummaryrefslogtreecommitdiff
path: root/sys/osb/bitmov.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/osb/bitmov.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/osb/bitmov.x')
-rw-r--r--sys/osb/bitmov.x30
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