General cleanup and direct export of bitreversal-array for faster access.
This commit is contained in:
parent
63f4c0b517
commit
28c2aeecd6
|
@ -1,8 +1,32 @@
|
|||
/* bitreverse.h
|
||||
*
|
||||
* Mirror the bits of an unsigned character so that b0 -> b7, b1 -> b6 etc.
|
||||
*
|
||||
* (C) 1998 Morten Rolland
|
||||
*/
|
||||
/* $Id$
|
||||
******************************************************************************
|
||||
|
||||
unsigned char bitrev(unsigned char v);
|
||||
Fax program for ISDN.
|
||||
Lookup tables to handle bit-reversal of 8-bits
|
||||
|
||||
Copyright (C) 1998 Morten Rolland [Morten.Rolland@asker.mail.telia.com]
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <ifax/types.h>
|
||||
|
||||
extern ifax_uint8 bitreverse[256];
|
||||
ifax_uint8 bitrev(ifax_uint8);
|
||||
|
|
|
@ -1,11 +1,35 @@
|
|||
/* bitreverse.c
|
||||
*
|
||||
* Mirror the bits of an unsigned character so that b0 -> b7, b1 -> b6 etc.
|
||||
*
|
||||
* (C) 1998 Morten Rolland
|
||||
*/
|
||||
/* $Id$
|
||||
******************************************************************************
|
||||
|
||||
static unsigned char bitreverse[256] = {
|
||||
Fax program for ISDN.
|
||||
Lookup tables to handle bit-reversal of 8-bits
|
||||
|
||||
Copyright (C) 1998 Morten Rolland [Morten.Rolland@asker.mail.telia.com]
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <ifax/types.h>
|
||||
#include <ifax/bitreverse.h>
|
||||
|
||||
ifax_uint8 bitreverse[256] = {
|
||||
0x00,0x80,0x40,0xc0,0x20,0xa0,0x60,0xe0,
|
||||
0x10,0x90,0x50,0xd0,0x30,0xb0,0x70,0xf0,
|
||||
0x08,0x88,0x48,0xc8,0x28,0xa8,0x68,0xe8,
|
||||
|
@ -40,7 +64,7 @@ static unsigned char bitreverse[256] = {
|
|||
0x1f,0x9f,0x5f,0xdf,0x3f,0xbf,0x7f,0xff
|
||||
};
|
||||
|
||||
unsigned char bitrev(unsigned char v)
|
||||
ifax_uint8 bitrev(ifax_uint8 v)
|
||||
{
|
||||
return bitreverse[v];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue