\op \p\()\d, \q\()\z
.endm
-.global bigendian_rotl32
; === bigendian_rotl32 ===
; this function rotates a 32bit bigendian word n bits to the left
; param1: the 32-bit value
; given in r25,r24,r23,r22
bigendian_rotl32:
- in r0, _SFR_IO_ADDR(SREG)
/* copy high bit of r22 to carry */
mov r1, r22
2:
brne 2b
bigendian_rotl32_exit:
clr r1
- out _SFR_IO_ADDR(SREG), r0
ret
/******************************************************************************/
-.global bigendian_rotr32
; === bigendian_rotl32 ===
; this function rotates a 32bit bigendian word n bits to the right
; param1: the 32-bit value
; given in r25,r24,r23,r22
bigendian_rotr32:
- in r0, _SFR_IO_ADDR(SREG)
/* copy high bit of r25 to carry */
mov r1, r25
brne 2b
bigendian_rotr32_exit:
clr r1
- out _SFR_IO_ADDR(SREG), r0
ret
/******************************************************************************/
push r25
push r24
pi_gamma_pi:
- clc
+ ldi r30, lo8(bigendian_rotl32)
+ ldi r31, hi8(bigendian_rotl32)
call pi
/* pi1 done; now gamma */
call gamma_1
eor state2_3, state3_3
*/
call gamma_1
- sec
+ ldi r30, lo8(bigendian_rotr32)
+ ldi r31, hi8(bigendian_rotr32)
call pi
ret
eor state0_3, r1
ret
-pi:
- brcs 1f
- ldi r30, lo8(bigendian_rotl32)
- ldi r31, hi8(bigendian_rotl32)
- rjmp 2f
-1:
- ldi r30, lo8(bigendian_rotr32)
- ldi r31, hi8(bigendian_rotr32)
-2:
+pi:
lsr r31
ror r30
/* a[1] <<<= 1*/