SpectrePoC
SpectrePoC copied to clipboard
Error comment on bit twiddling trick
https://github.com/crozone/SpectrePoC/blob/2a01f8647c2966991dd50ef8b96ed25b85c25297/spectre.c#L193
should be
/* Set x=0xFFFFFFFFFFFFFFFF if x=0xFFFFFFFFFFFF0000, else x=0 */
// or
/* Set x=-1 if j%6=0, else x=0 */
It's clearly that the 2's complement of -1 is 0xFFFFFFFFFFFF0000 and there is no logic for j&6.
This Error has been copied or spread for so many repos.
Agreed, comment should be /* Set x=0xFFFFFFFFFFFFFFFF if x=0xFFFFFFFFFFFF0000, else x=0 */, although maybe something like:
/* Bitwise OR the upper bytes of x over the lower two bytes of x, such that if x was 0xFFFFFFFFFFFF0000, it becomes 0xFFFFFFFFFFFFFFFF. Otherwise, if x was 0, it remains as 0 */