This commit is contained in:
Philippe Teuwen committed 2021-10-10 01:35:45 +02:00
1 parent 0ed66781a7
commit 88308ea727
98 files changed
+271 -271

No files matched your search

+8 -8
View File
@@ -192,7 +192,7 @@ static inline uint8_t bit_rotate_r(uint8_t a, uint8_t n_bits) {
#define BIT_ROR(a) (((a) >> 1) | (((a) & 1) << 4))
static uint8_t lookup_left_substraction[0x400];
static uint8_t lookup_left_subtraction[0x400];
static uint8_t lookup_right_subtraction[0x400];
static lookup_entry lookup_left[0x100000];
static lookup_entry lookup_right[0x8000];
@@ -232,17 +232,17 @@ static inline void init_lookup_right() {
}
}
static void init_lookup_left_substraction() {
static void init_lookup_left_subtraction() {
for (int index = 0; index < 0x400 ; index++) {
uint8_t b3 = (index >> 5 & 0x1f);
uint8_t bx = (index & 0x1f);
//lookup_left_substraction[index] = bit_rotate_r(mod((bx+0x1f)-b3,0x1f),5);
lookup_left_substraction[index] = BIT_ROR(mod((bx + 0x1F) - b3, 0x1F));
//lookup_left_subtraction[index] = bit_rotate_r(mod((bx+0x1f)-b3,0x1f),5);
lookup_left_subtraction[index] = BIT_ROR(mod((bx + 0x1F) - b3, 0x1F));
}
}
static void init_lookup_right_substraction() {
static void init_lookup_right_subtraction() {
for (int index = 0; index < 0x400 ; index++) {
int b16 = (index >> 5);
uint8_t bx = (index & 0x1f);
@@ -271,7 +271,7 @@ static inline void previous_left(uint8_t in, vector<cs_t> *candidate_states) {
state->l ^= (((uint64_t)in & 0x1f) << 20);
}
} else {
uint8_t b6 = lookup_left_substraction[b3 | bx];
uint8_t b6 = lookup_left_subtraction[b3 | bx];
state->l = (state->l & 0x7ffffffe0ull) | b6;
state->l ^= (((uint64_t)in & 0x1f) << 20);
@@ -1050,8 +1050,8 @@ int main(int argc, const char *argv[]) {
std::thread foo_left(init_lookup_left);
std::thread foo_right(init_lookup_right);
std::thread foo_leftsub(init_lookup_left_substraction);
std::thread foo_rightsub(init_lookup_right_substraction);
std::thread foo_leftsub(init_lookup_left_subtraction);
std::thread foo_rightsub(init_lookup_right_subtraction);
foo_left.join();
foo_right.join();