+// SPDX-License-Identifier: GPL-2.0
/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ * Copyright (c) 2000 Silicon Graphics, Inc.
+ * All Rights Reserved.
*/
#include <stdio.h>
#include <stdlib.h>
}
nmults = ((max - min) / mult) + 1;
-#if CRAY
- /*
- * If max is less than 2gb, then the value can fit in 32 bits
- * and the standard lrand48() routine can be used.
- */
- if ( max <= (long)2147483647 ) {
- return (long) (min + (((long)lrand48() % nmults) * mult));
- } else {
- /*
- * max is greater than 2gb - meeds more than 32 bits.
- * Since lrand48 only will get a number up to 32bits.
- */
- long randnum;
- randnum=divider(min, max, 0, -1);
- return (long) (min + ((randnum % nmults) * mult));
- }
-
-#else
return (min + ((lrand48() % nmults) * mult));
-#endif
-
}
/*
}
nmults = ((max - min) / mult) + 1;
-#if CRAY || (_MIPS_SZLONG == 64)
+#if (_MIPS_SZLONG == 64)
/*
* If max is less than 2gb, then the value can fit in 32 bits
* and the standard lrand48() routine can be used.
/*
* get the number of bits set in mask
*/
-#ifndef CRAY
-
bit=1L;
for ( nshift=0; nshift<sizeof(long)*8; nshift++) {
if ( mask & bit )
bit=bit<<1;
}
-#else
- nbits=_popcnt(mask);
-#endif /* if CRAY */
-
/*
* randomly choose a bit.
*/
int ind;
int cnt, iter=10;
int imin=0, imult=1, itmin, itmax=0;
-#if CRAY
- int imax=6*GIG; /* higher than 32 bits */
-#else
int imax=1048576;
-#endif
long lret, lmin=0, lmult=1, ltmin, ltmax=0;
-#if CRAY || (_MIPS_SZLONG == 64)
+#if (_MIPS_SZLONG == 64)
long lmax=6*(long)GIG; /* higher than 32 bits */
#else
long lmax=1048576;