Commit 835e41aa authored by michael's avatar michael

replace / by >> this makes the .o ~150 bytes smaller


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@7525 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent c1df5e6a
...@@ -101,7 +101,7 @@ void av_aes_encrypt(AVAES *a){ ...@@ -101,7 +101,7 @@ void av_aes_encrypt(AVAES *a){
static void init_multbl2(uint8_t tbl[1024], int c[4], uint8_t *log8, uint8_t *alog8, uint8_t *sbox){ static void init_multbl2(uint8_t tbl[1024], int c[4], uint8_t *log8, uint8_t *alog8, uint8_t *sbox){
int i, j; int i, j;
for(i=0; i<1024; i++){ for(i=0; i<1024; i++){
int x= sbox[i/4]; int x= sbox[i>>2];
if(x) tbl[i]= alog8[ log8[x] + log8[c[i&3]] ]; if(x) tbl[i]= alog8[ log8[x] + log8[c[i&3]] ];
} }
#ifndef CONFIG_SMALL #ifndef CONFIG_SMALL
...@@ -116,7 +116,7 @@ AVAES *av_aes_init(uint8_t *key, int key_bits, int decrypt) { ...@@ -116,7 +116,7 @@ AVAES *av_aes_init(uint8_t *key, int key_bits, int decrypt) {
AVAES *a; AVAES *a;
int i, j, t, rconpointer = 0; int i, j, t, rconpointer = 0;
uint8_t tk[8][4]; uint8_t tk[8][4];
int KC= key_bits/32; int KC= key_bits>>5;
int rounds= KC + 6; int rounds= KC + 6;
uint8_t log8[256]; uint8_t log8[256];
uint8_t alog8[512]; uint8_t alog8[512];
...@@ -158,7 +158,7 @@ AVAES *av_aes_init(uint8_t *key, int key_bits, int decrypt) { ...@@ -158,7 +158,7 @@ AVAES *av_aes_init(uint8_t *key, int key_bits, int decrypt) {
tk[0][0] ^= rcon[rconpointer++]; tk[0][0] ^= rcon[rconpointer++];
for(j = 1; j < KC; j++){ for(j = 1; j < KC; j++){
if(KC != 8 || j != KC/2) if(KC != 8 || j != KC>>1)
for(i = 0; i < 4; i++) tk[j][i] ^= tk[j-1][i]; for(i = 0; i < 4; i++) tk[j][i] ^= tk[j-1][i];
else else
for(i = 0; i < 4; i++) tk[j][i] ^= sbox[tk[j-1][i]]; for(i = 0; i < 4; i++) tk[j][i] ^= sbox[tk[j-1][i]];
...@@ -172,7 +172,7 @@ AVAES *av_aes_init(uint8_t *key, int key_bits, int decrypt) { ...@@ -172,7 +172,7 @@ AVAES *av_aes_init(uint8_t *key, int key_bits, int decrypt) {
mix(a->round_key[i], dec_multbl); mix(a->round_key[i], dec_multbl);
} }
}else{ }else{
for(i=0; i<(rounds+1)/2; i++){ for(i=0; i<(rounds+1)>>1; i++){
for(j=0; j<16; j++) for(j=0; j<16; j++)
FFSWAP(int, a->round_key[i][0][j], a->round_key[rounds-i][0][j]); FFSWAP(int, a->round_key[i][0][j], a->round_key[rounds-i][0][j]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment