update cspot

This commit is contained in:
philippe44
2022-11-17 14:06:00 -08:00
parent a81d0e0513
commit 7e5f27af12
137 changed files with 6046 additions and 836 deletions

View File

@@ -9,20 +9,16 @@ using std::size_t;
static inline uint32_t rotl(uint32_t n, unsigned int c)
{
const unsigned int mask = (CHAR_BIT * sizeof(n) - 1); // assumes width is a power of 2.
// assert ( (c<=mask) &&"rotate by type width or more");
c &= mask;
return (n << c) | (n >> ((-c) & mask));
c &= sizeof(n) * CHAR_BIT - 1;
return (n << c) | (n >> (sizeof(n)*CHAR_BIT-c));
}
static inline uint32_t rotr(uint32_t n, unsigned int c)
{
const unsigned int mask = (CHAR_BIT * sizeof(n) - 1);
// assert ( (c<=mask) &&"rotate by type width or more");
c &= mask;
return (n >> c) | (n << ((-c) & mask));
c &= sizeof(n) * CHAR_BIT - 1;
return (n >> c) | (n << (sizeof(n)*CHAR_BIT-c));
}
uint32_t Shannon::sbox1(uint32_t w)