mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
4025. [port] bsdi: failed to build. [RT #38047]
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
#include <math.h>
|
||||
|
||||
typedef double (pvalue_func_t)(isc_mem_t *mctx,
|
||||
uint16_t *values, size_t length);
|
||||
isc_uint16_t *values, size_t length);
|
||||
|
||||
/* igamc(), igam(), etc. were adapted (and cleaned up) from the Cephes
|
||||
* math library:
|
||||
@@ -138,17 +138,17 @@ igam(double a, double x) {
|
||||
return (ans * ax / a);
|
||||
}
|
||||
|
||||
static int8_t scounts_table[65536];
|
||||
static uint8_t bitcounts_table[65536];
|
||||
static isc_int8_t scounts_table[65536];
|
||||
static isc_uint8_t bitcounts_table[65536];
|
||||
|
||||
static int8_t
|
||||
scount_calculate(uint16_t n) {
|
||||
static isc_int8_t
|
||||
scount_calculate(isc_uint16_t n) {
|
||||
int i;
|
||||
int8_t sc;
|
||||
isc_int8_t sc;
|
||||
|
||||
sc = 0;
|
||||
for (i = 0; i < 16; i++) {
|
||||
uint16_t lsb;
|
||||
isc_uint16_t lsb;
|
||||
|
||||
lsb = n & 1;
|
||||
if (lsb != 0)
|
||||
@@ -162,14 +162,14 @@ scount_calculate(uint16_t n) {
|
||||
return (sc);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
bitcount_calculate(uint16_t n) {
|
||||
static isc_uint8_t
|
||||
bitcount_calculate(isc_uint16_t n) {
|
||||
int i;
|
||||
uint8_t bc;
|
||||
isc_uint8_t bc;
|
||||
|
||||
bc = 0;
|
||||
for (i = 0; i < 16; i++) {
|
||||
uint16_t lsb;
|
||||
isc_uint16_t lsb;
|
||||
|
||||
lsb = n & 1;
|
||||
if (lsb != 0)
|
||||
@@ -183,7 +183,7 @@ bitcount_calculate(uint16_t n) {
|
||||
|
||||
static void
|
||||
tables_init(void) {
|
||||
uint32_t i;
|
||||
isc_uint32_t i;
|
||||
|
||||
for (i = 0; i < 65536; i++) {
|
||||
scounts_table[i] = scount_calculate(i);
|
||||
@@ -198,12 +198,12 @@ tables_init(void) {
|
||||
*
|
||||
* This function destroys (modifies) the data passed in bits.
|
||||
*/
|
||||
static uint32_t
|
||||
matrix_binaryrank(uint32_t *bits, ssize_t rows, ssize_t cols) {
|
||||
static isc_uint32_t
|
||||
matrix_binaryrank(isc_uint32_t *bits, ssize_t rows, ssize_t cols) {
|
||||
ssize_t i, j, k;
|
||||
int rt = 0;
|
||||
uint32_t rank = 0;
|
||||
uint32_t tmp;
|
||||
isc_uint32_t rank = 0;
|
||||
isc_uint32_t tmp;
|
||||
|
||||
for (k = 0; k < rows; k++) {
|
||||
i = k;
|
||||
@@ -249,10 +249,10 @@ random_test(pvalue_func_t *func) {
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_result_t result;
|
||||
isc_rng_t *rng;
|
||||
uint32_t m;
|
||||
uint32_t j;
|
||||
uint32_t histogram[11];
|
||||
uint32_t passed;
|
||||
isc_uint32_t m;
|
||||
isc_uint32_t j;
|
||||
isc_uint32_t histogram[11];
|
||||
isc_uint32_t passed;
|
||||
double proportion;
|
||||
double p_hat;
|
||||
double lower_confidence;
|
||||
@@ -275,8 +275,8 @@ random_test(pvalue_func_t *func) {
|
||||
histogram[j] = 0;
|
||||
|
||||
for (j = 0; j < m; j++) {
|
||||
uint32_t i;
|
||||
uint16_t values[128000];
|
||||
isc_uint32_t i;
|
||||
isc_uint16_t values[128000];
|
||||
double p_value;
|
||||
|
||||
for (i = 0; i < 128000; i++)
|
||||
@@ -350,10 +350,10 @@ random_test(pvalue_func_t *func) {
|
||||
* RNG test suite.
|
||||
*/
|
||||
static double
|
||||
monobit(isc_mem_t *mctx, uint16_t *values, size_t length) {
|
||||
monobit(isc_mem_t *mctx, isc_uint16_t *values, size_t length) {
|
||||
size_t i;
|
||||
int32_t scount;
|
||||
uint32_t numbits;
|
||||
isc_int32_t scount;
|
||||
isc_uint32_t numbits;
|
||||
double s_obs;
|
||||
double p_value;
|
||||
|
||||
@@ -381,17 +381,17 @@ monobit(isc_mem_t *mctx, uint16_t *values, size_t length) {
|
||||
* This is the runs test taken from the NIST SP 800-22 RNG test suite.
|
||||
*/
|
||||
static double
|
||||
runs(isc_mem_t *mctx, uint16_t *values, size_t length) {
|
||||
runs(isc_mem_t *mctx, isc_uint16_t *values, size_t length) {
|
||||
size_t i;
|
||||
uint32_t bcount;
|
||||
uint32_t numbits;
|
||||
isc_uint32_t bcount;
|
||||
isc_uint32_t numbits;
|
||||
double pi;
|
||||
double tau;
|
||||
uint32_t j;
|
||||
uint32_t b;
|
||||
uint8_t bit_this;
|
||||
uint8_t bit_prev;
|
||||
uint32_t v_obs;
|
||||
isc_uint32_t j;
|
||||
isc_uint32_t b;
|
||||
isc_uint8_t bit_this;
|
||||
isc_uint8_t bit_prev;
|
||||
isc_uint32_t v_obs;
|
||||
double numer;
|
||||
double denom;
|
||||
double p_value;
|
||||
@@ -457,14 +457,14 @@ runs(isc_mem_t *mctx, uint16_t *values, size_t length) {
|
||||
* test suite.
|
||||
*/
|
||||
static double
|
||||
blockfrequency(isc_mem_t *mctx, uint16_t *values, size_t length) {
|
||||
uint32_t i;
|
||||
uint32_t numbits;
|
||||
uint32_t mbits;
|
||||
uint32_t mwords;
|
||||
uint32_t numblocks;
|
||||
blockfrequency(isc_mem_t *mctx, isc_uint16_t *values, size_t length) {
|
||||
isc_uint32_t i;
|
||||
isc_uint32_t numbits;
|
||||
isc_uint32_t mbits;
|
||||
isc_uint32_t mwords;
|
||||
isc_uint32_t numblocks;
|
||||
double *pi;
|
||||
uint32_t cur_word;
|
||||
isc_uint32_t cur_word;
|
||||
double chi_square;
|
||||
double p_value;
|
||||
|
||||
@@ -487,10 +487,10 @@ blockfrequency(isc_mem_t *mctx, uint16_t *values, size_t length) {
|
||||
|
||||
cur_word = 0;
|
||||
for (i = 0; i < numblocks; i++) {
|
||||
uint32_t j;
|
||||
isc_uint32_t j;
|
||||
pi[i] = 0.0;
|
||||
for (j = 0; j < mwords; j++) {
|
||||
uint32_t idx;
|
||||
isc_uint32_t idx;
|
||||
|
||||
idx = i * mwords + j;
|
||||
pi[i] += bitcounts_table[values[idx]];
|
||||
@@ -521,15 +521,15 @@ blockfrequency(isc_mem_t *mctx, uint16_t *values, size_t length) {
|
||||
* test suite.
|
||||
*/
|
||||
static double
|
||||
binarymatrixrank(isc_mem_t *mctx, uint16_t *values, size_t length) {
|
||||
uint32_t i;
|
||||
binarymatrixrank(isc_mem_t *mctx, isc_uint16_t *values, size_t length) {
|
||||
isc_uint32_t i;
|
||||
size_t matrix_m;
|
||||
size_t matrix_q;
|
||||
uint32_t num_matrices;
|
||||
isc_uint32_t num_matrices;
|
||||
size_t numbits;
|
||||
uint32_t fm_0;
|
||||
uint32_t fm_1;
|
||||
uint32_t fm_rest;
|
||||
isc_uint32_t fm_0;
|
||||
isc_uint32_t fm_1;
|
||||
isc_uint32_t fm_rest;
|
||||
double term1;
|
||||
double term2;
|
||||
double term3;
|
||||
@@ -553,17 +553,17 @@ binarymatrixrank(isc_mem_t *mctx, uint16_t *values, size_t length) {
|
||||
fm_rest = 0;
|
||||
for (i = 0; i < num_matrices; i++) {
|
||||
/*
|
||||
* Each uint32_t supplies 32 bits, so a 32x32 bit matrix
|
||||
* takes up uint32_t array of size 32.
|
||||
* Each isc_uint32_t supplies 32 bits, so a 32x32 bit matrix
|
||||
* takes up isc_uint32_t array of size 32.
|
||||
*/
|
||||
uint32_t bits[32];
|
||||
isc_uint32_t bits[32];
|
||||
int j;
|
||||
uint32_t rank;
|
||||
isc_uint32_t rank;
|
||||
|
||||
for (j = 0; j < 32; j++) {
|
||||
size_t idx;
|
||||
uint32_t r1;
|
||||
uint32_t r2;
|
||||
isc_uint32_t r1;
|
||||
isc_uint32_t r2;
|
||||
|
||||
idx = i * ((matrix_m * matrix_q) / 16);
|
||||
idx += j * 2;
|
||||
|
Reference in New Issue
Block a user