In sc_add (crypto-ops.c) we first load three chars, we mask with 2097151 (loosing information?):
int64_t a0 = 2097151 & load_3(a);
Then continue with something similar, but this time with four chars, starting with one that we already loaded in the last step (?!). And we shift by 5:
int64_t a1 = 2097151 & (load_4(a + 2) >> 5);
Later we shift by other values, like 7:
int64_t a3 = 2097151 & (load_4(a + 7) >> 7);
Why the overlapping? Why the AND'ing / masking? Based on what do we decide how many steps to shift?
Why not just add like
'a' + 'c' = 'd' (and
'z' + 'a' = 'a'), primitively speaking?
It's been ages for me since I last handled bitwise operations, so I'm struggling to see the pattern and logic here. Those shifts for example mostly have me think we're discarding information.
As you can see, I'm pretty much a n00b on this, but maybe someone can lend a hand and get me on the right track?