gen/genacorn.c
static void extract_one_part(int reg, int bit)
{
    const LFSR *lfsr = find_lfsr(bit);
    int offset;
    bit -= lfsr->start;
    offset = lfsr->offsetl + lfsr_offset + (bit / 8);
    bit %= 8;
    if (bit < 4) {
        insn_printf("ldd r%d,Z+%d", reg, offset);
        insn_printf("ldd r%d,Z+%d", temp_reg, offset + 1);
        shift_right_2_regs(temp_reg, reg, bit);
    } else if (bit > 4) {
        insn_printf("ldd r%d,Z+%d", temp_reg, offset);
        insn_printf("ldd r%d,Z+%d", reg, offset + 1);
        shift_left_2_regs(reg, temp_reg, 8 - bit);
    } else {
        int extra_reg = -1;
        alloc_high_reg(&extra_reg);
        insn_printf("ldd r%d,Z+%d", reg, offset);
        insn_printf("ldd r%d,Z+%d", extra_reg, offset + 1);
        insn_printf("swap r%d", reg);
        insn_printf("swap r%d", extra_reg);
        check_high_reg(&reg);
        check_high_reg(&extra_reg);
        insn_printf("andi r%d,0x0F", reg);       // Assumes reg and extra_reg
        insn_printf("andi r%d,0xF0", extra_reg); // are high registers.
        insn_printf("or r%d,r%d", reg, extra_reg);
        release_reg(&extra_reg);
    }
}
// Extracts one part from the state as a byte.
Extracts one part from the state as a byte.
Extracts one part from the state as a byte .
static void extract_one_part(int reg, int bit)
{
    const LFSR *lfsr = find_lfsr(bit);
    int offset;
    bit -= lfsr->start;
    offset = lfsr->offsetl + lfsr_offset + (bit / 8);
    bit %= 8;
    if (bit < 4) {
        insn_printf("ldd r%d,Z+%d", reg, offset);
        insn_printf("ldd r%d,Z+%d", temp_reg, offset + 1);
        shift_right_2_regs(temp_reg, reg, bit);
    } else if (bit > 4) {
        insn_printf("ldd r%d,Z+%d", temp_reg, offset);
        insn_printf("ldd r%d,Z+%d", reg, offset + 1);
        shift_left_2_regs(reg, temp_reg, 8 - bit);
    } else {
        int extra_reg = -1;
        alloc_high_reg(&extra_reg);
        insn_printf("ldd r%d,Z+%d", reg, offset);
        insn_printf("ldd r%d,Z+%d", extra_reg, offset + 1);
        insn_printf("swap r%d", reg);
        insn_printf("swap r%d", extra_reg);
        check_high_reg(&reg);
        check_high_reg(&extra_reg);
        insn_printf("andi r%d,0x0F", reg);       
        insn_printf("andi r%d,0xF0", extra_reg); 
        insn_printf("or r%d,r%d", reg, extra_reg);
        release_reg(&extra_reg);
    }
}
static void extract_one_part ( int reg , int bit ) { const LFSR * lfsr = find_lfsr ( bit ) ; int offset ; bit -= lfsr -> start ; offset = lfsr -> offsetl + lfsr_offset + ( bit / 8 ) ; bit %= 8 ; if ( bit < 4 ) { insn_printf ( " " , reg , offset ) ; insn_printf ( " " , temp_reg , offset + 1 ) ; shift_right_2_regs ( temp_reg , reg , bit ) ; } else if ( bit > 4 ) { insn_printf ( " " , temp_reg , offset ) ; insn_printf ( " " , reg , offset + 1 ) ; shift_left_2_regs ( reg , temp_reg , 8 - bit ) ; } else { int extra_reg = -1 ; alloc_high_reg ( & extra_reg ) ; insn_printf ( " " , reg , offset ) ; insn_printf ( " " , extra_reg , offset + 1 ) ; insn_printf ( " " , reg ) ; insn_printf ( " " , extra_reg ) ; check_high_reg ( & reg ) ; check_high_reg ( & extra_reg ) ; insn_printf ( " " , reg ) ; insn_printf ( " " , extra_reg ) ; insn_printf ( " " , reg , extra_reg ) ; release_reg ( & extra_reg ) ; } }
Extracts one part from the state as a byte.
Extracts one part from the state as a byte .
// Assumes reg and extra_reg // are high registers.