X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/e3dc2d225ea40a7453ae19ef4d12cf4c001076bd..78614e02310dbe879d55f0a68e47349db074ff61:/maurer.c diff --git a/maurer.c b/maurer.c index 9846f89..a6dd31a 100644 --- a/maurer.c +++ b/maurer.c @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: maurer.c,v 1.2 2000/08/11 21:34:59 mdw Exp $ + * $Id: maurer.c,v 1.4 2004/04/08 01:36:15 mdw Exp $ * * Maurer's universal statistical test * * (c) 2000 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,29 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: maurer.c,v $ - * Revision 1.2 2000/08/11 21:34:59 mdw - * New restartable interface to Maurer testing. - * - * Revision 1.1 2000/06/17 11:29:49 mdw - * Maurer's universal statistical test. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -60,33 +49,6 @@ typedef struct bitscan { /*----- Main code ---------------------------------------------------------*/ -/* --- @more@ --- * - * - * Arguments: @bitscan *b@ = pointer to a bitscanner structure - * @unsigned l@ = number of bits wanted - * - * Returns: An integer representing the next @l@ bits of the stream. - * - * Use: Fetches the next @l@ bits of a data stream. The bitscanner - * has no way of knowing whether it's run out of data, so make - * sure that doesn't happen. - */ - -static unsigned more(bitscan *b, unsigned l) -{ - unsigned x, m; - - while (b->b < l) { - b->a |= U8(*b->p++) << b->b; - b->b += 8; - } - m = (1 << l) - 1; - x = b->a & m; - b->a >>= l; - b->b -= l; - return (x); -} - /* --- @maurer_init@ --- * * * Arguments: @maurer_ctx *m@ = pointer to a context to initialize