Bit-ShiftReg

 view release on metacpan or  search on metacpan

ShiftReg.xs  view on Meta::CPAN


    while (sample <<= 1) BIT_byte++;   /* determine # of bits */

    MSB_byte = (LSB_byte << BIT_byte++);
}


void config_short(void)
{
    N_short sample = LSB_short;

    BIT_short = 0;

    while (sample <<= 1) BIT_short++;   /* determine # of bits */

    MSB_short = (LSB_short << BIT_short++);
}


void config_int(void)
{
    N_int sample = LSB_int;

    BIT_int = 0;

    while (sample <<= 1) BIT_int++;   /* determine # of bits */

    MSB_int = (LSB_int << BIT_int++);
}


void config_long(void)
{
    N_long sample = LSB_long;

    BIT_long = 0;

    while (sample <<= 1) BIT_long++;   /* determine # of bits */

    MSB_long = (LSB_long << BIT_long++);
}


MODULE = Bit::ShiftReg		PACKAGE = Bit::ShiftReg


PROTOTYPES: DISABLE


BOOT:
{
    config_byte();
    config_short();
    config_int();
    config_long();
}


void
Version()
PPCODE:
{
    EXTEND(sp,1);
    PUSHs(sv_2mortal(newSVpv("2.0",0)));
}


N_char
bits_of_byte()
CODE:
{
    RETVAL = BIT_byte;
}
OUTPUT:
RETVAL


N_short
bits_of_short()
CODE:
{
    RETVAL = BIT_short;
}
OUTPUT:
RETVAL


N_int
bits_of_int()
CODE:
{
    RETVAL = BIT_int;
}
OUTPUT:
RETVAL


N_long
bits_of_long()
CODE:
{
    RETVAL = BIT_long;
}
OUTPUT:
RETVAL


boolean
LSB_byte(value)
N_char	value
CODE:
{
    RETVAL = ((value AND LSB_byte) != 0);
}
OUTPUT:
RETVAL


boolean
MSB_byte(value)
N_char	value



( run in 0.605 second using v1.01-cache-2.11-cpan-71847e10f99 )