UBC-ECE-Sasha / PIM-encryption

Block decryption in memory
2 stars 2 forks source link

Use a KILOBYTE macro #10

Closed jnider closed 4 years ago

jnider commented 4 years ago

https://github.com/UBC-ECE-Sasha/PIM-encryption/blob/8de4e5fd3ff8c70b007441edd5f6882e9af9ef92/host/host.c#L24

Shifting is the right thing to do, but wrapping it with a little macro would make it a lot easier to read (and avoid mistakes like shifting by the wrong amount when changing the value in the future). There is already a MEGABYTE() macro in PIM-common, so you could add a KILOBYTE() macro and use it in this case.

jnider commented 4 years ago

Same for a bit farther down: case 'K': test_data_size <<= 10; break; case 'M': test_data_size <<= 20; break; case 'G': test_data_size <<= 30; break;