aboutsummaryrefslogtreecommitdiff
path: root/sys/vops/lz/apowks.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/vops/lz/apowks.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/vops/lz/apowks.x')
-rw-r--r--sys/vops/lz/apowks.x34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/vops/lz/apowks.x b/sys/vops/lz/apowks.x
new file mode 100644
index 00000000..f656115a
--- /dev/null
+++ b/sys/vops/lz/apowks.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# APOWK -- Compute a ** b, where b is a constant of type INT (generic).
+
+procedure apowks (a, b, c, npix)
+
+short a[ARB], c[ARB]
+int b
+int npix, i
+
+begin
+ # Optimize the code for the various special cases. We assume that the
+ # compiler is intelligent enough to recognize the special cases if the
+ # power is expressed as an integer constant.
+
+ switch (b) {
+ case 0:
+ call amovks (1, c, npix)
+ case 1:
+ call amovs (a, c, npix)
+ case 2:
+ do i = 1, npix
+ c[i] = a[i] ** 2
+ case 3:
+ do i = 1, npix
+ c[i] = a[i] ** 3
+ case 4:
+ do i = 1, npix
+ c[i] = a[i] ** 4
+ default:
+ do i = 1, npix
+ c[i] = a[i] ** b
+ }
+end