diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
commit | 9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /contrib/libs/base64/neon32/enc_uint32.c | |
parent | 8cbc307de0221f84c80c42dcbe07d40727537e2c (diff) | |
download | ydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/base64/neon32/enc_uint32.c')
-rw-r--r-- | contrib/libs/base64/neon32/enc_uint32.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/contrib/libs/base64/neon32/enc_uint32.c b/contrib/libs/base64/neon32/enc_uint32.c index a9f49375bd..c7bc3cd234 100644 --- a/contrib/libs/base64/neon32/enc_uint32.c +++ b/contrib/libs/base64/neon32/enc_uint32.c @@ -1,24 +1,24 @@ -// If we have 32-bit ints, pick off 3 bytes at a time for as long as we can, -// but ensure that there are at least 4 bytes available to avoid segfaulting: -while (srclen >= 4) -{ - // Load string: - uint32_t str = *(uint32_t *)c; - - // Reorder to 32-bit big-endian, if not already in that format. The - // workset must be in big-endian, otherwise the shifted bits do not - // carry over properly among adjacent bytes: - str = cpu_to_be32(str); - - // Shift input by 6 bytes each round and mask in only the lower 6 bits; - // look up the character in the Base64 encoding table and write it to - // the output location: - *o++ = neon32_base64_table_enc[(str >> 26) & 0x3F]; - *o++ = neon32_base64_table_enc[(str >> 20) & 0x3F]; - *o++ = neon32_base64_table_enc[(str >> 14) & 0x3F]; - *o++ = neon32_base64_table_enc[(str >> 8) & 0x3F]; - - c += 3; // 3 bytes of input - outl += 4; // 4 bytes of output - srclen -= 3; -} +// If we have 32-bit ints, pick off 3 bytes at a time for as long as we can, +// but ensure that there are at least 4 bytes available to avoid segfaulting: +while (srclen >= 4) +{ + // Load string: + uint32_t str = *(uint32_t *)c; + + // Reorder to 32-bit big-endian, if not already in that format. The + // workset must be in big-endian, otherwise the shifted bits do not + // carry over properly among adjacent bytes: + str = cpu_to_be32(str); + + // Shift input by 6 bytes each round and mask in only the lower 6 bits; + // look up the character in the Base64 encoding table and write it to + // the output location: + *o++ = neon32_base64_table_enc[(str >> 26) & 0x3F]; + *o++ = neon32_base64_table_enc[(str >> 20) & 0x3F]; + *o++ = neon32_base64_table_enc[(str >> 14) & 0x3F]; + *o++ = neon32_base64_table_enc[(str >> 8) & 0x3F]; + + c += 3; // 3 bytes of input + outl += 4; // 4 bytes of output + srclen -= 3; +} |