aboutsummaryrefslogtreecommitdiff
path: root/sys/gio/nspp/sysint/ishift.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/gio/nspp/sysint/ishift.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/gio/nspp/sysint/ishift.x')
-rw-r--r--sys/gio/nspp/sysint/ishift.x55
1 files changed, 55 insertions, 0 deletions
diff --git a/sys/gio/nspp/sysint/ishift.x b/sys/gio/nspp/sysint/ishift.x
new file mode 100644
index 00000000..580996c0
--- /dev/null
+++ b/sys/gio/nspp/sysint/ishift.x
@@ -0,0 +1,55 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <mach.h>
+
+# ISHIFT -- integer shift. To be used for calls to ISHIFT in NCAR routines.
+
+int procedure ishift (in_word, n)
+
+int in_word, n
+int new_word, bit, index, i
+int bitupk()
+
+begin
+ if (n > NBITS_INT)
+ call error (0, "n > NBITS_INT in ishift")
+ if (n < 0)
+ # Right end-off shift
+ new_word = bitupk (in_word, abs(n) + 1, NBITS_INT - abs(n))
+ else {
+ # Left circular shift (rotate)
+ do i = 1, NBITS_INT {
+ index = n + i
+ if (index > NBITS_INT)
+ index = mod ((n + i), NBITS_INT)
+ bit = bitupk (in_word, i, 1)
+ call bitpak (bit, new_word, index, 1)
+ }
+ }
+
+ return (new_word)
+end
+
+
+# IAND -- AND two integers.
+
+int procedure iand (a, b)
+
+int a, b
+int and()
+
+begin
+ return (and (a, b))
+end
+
+
+# IOR -- OR two integers.
+
+int procedure ior (a, b)
+
+int a, b
+int or()
+
+begin
+ return (or (a, b))
+end