From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/vops/lz/apowkl.x | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sys/vops/lz/apowkl.x (limited to 'sys/vops/lz/apowkl.x') diff --git a/sys/vops/lz/apowkl.x b/sys/vops/lz/apowkl.x new file mode 100644 index 00000000..c7247f3e --- /dev/null +++ b/sys/vops/lz/apowkl.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 apowkl (a, b, c, npix) + +long 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 amovkl (1, c, npix) + case 1: + call amovl (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 -- cgit