1/* $OpenBSD$ */ 2 3/*- 4 * Copyright (c) 2002 Jason L. Wright (jason@thought.net) 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 18 unchanged lines hidden (view full) --- 27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/dev/rndtest/rndtest.c 249582 2013-04-17 11:40:10Z gabor $"); |
36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/bus.h> 40#include <sys/callout.h> 41#include <sys/kernel.h> 42#include <sys/malloc.h> 43#include <sys/module.h> --- 311 unchanged lines hidden (view full) --- 355static int 356rndtest_chi_4(struct rndtest_state *rsp) 357{ 358 unsigned int freq[RNDTEST_CHI4_K], i, sum; 359 360 for (i = 0; i < RNDTEST_CHI4_K; i++) 361 freq[i] = 0; 362 |
363 /* Get number of occurrences of each 4 bit pattern */ |
364 for (i = 0; i < RNDTEST_NBYTES; i++) { 365 freq[(rsp->rs_buf[i] >> 4) & RNDTEST_CHI4_K_MASK]++; 366 freq[(rsp->rs_buf[i] >> 0) & RNDTEST_CHI4_K_MASK]++; 367 } 368 369 for (i = 0, sum = 0; i < RNDTEST_CHI4_K; i++) 370 sum += freq[i] * freq[i]; 371 --- 37 unchanged lines hidden --- |