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/imul32.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 sys/osb/imul32.c (limited to 'sys/osb/imul32.c') diff --git a/sys/osb/imul32.c b/sys/osb/imul32.c new file mode 100644 index 00000000..237bd5fa --- /dev/null +++ b/sys/osb/imul32.c @@ -0,0 +1,24 @@ +#define import_spp +#define import_knames +#include + + +/* IMUL32 - Multiply two integer values and return the result. This is + * needed to allow e.g. the normal overflow condition to occur for algorithms + * such as random number generators. + */ +int +IMUL32 (long *a, long *b) +{ + int val = 0; + int ia = (int) *a; + int ib = (int) *b; + + + /* MACHDEP - Depends on integer overflow behavior for a specific + * platform. + */ + val = ia * ib; + + return ((int) val); +} -- cgit