generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / lib / random_range.c
index cb68fe5e79701e988e1ffcbcb429499175f1beed..3fa01f0ddffda9ddb6c4db30321877e12a624266 100644 (file)
@@ -1,19 +1,7 @@
+// 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 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.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include <stdio.h>
 #include <stdlib.h>
@@ -338,27 +326,7 @@ char       **errp;
        }
 
        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
-
 }
 
 /*
@@ -430,7 +398,7 @@ char        **errp;
        }
 
        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.
@@ -648,8 +616,6 @@ random_bit(long mask)
     /*
      * get the number of bits set in mask
      */
-#ifndef CRAY
-
         bit=1L;
         for ( nshift=0; nshift<sizeof(long)*8; nshift++) {
                 if ( mask & bit )
@@ -657,10 +623,6 @@ random_bit(long mask)
                 bit=bit<<1;
         }
 
-#else
-        nbits=_popcnt(mask);
-#endif  /* if CRAY */
-
     /*
      * randomly choose a bit.
      */
@@ -740,14 +702,10 @@ char **argv;
     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;