aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/base64/ssse3/lib.c
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:48 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:48 +0300
commit9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /contrib/libs/base64/ssse3/lib.c
parent8cbc307de0221f84c80c42dcbe07d40727537e2c (diff)
downloadydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/base64/ssse3/lib.c')
-rw-r--r--contrib/libs/base64/ssse3/lib.c242
1 files changed, 121 insertions, 121 deletions
diff --git a/contrib/libs/base64/ssse3/lib.c b/contrib/libs/base64/ssse3/lib.c
index 3c9cf99fc2..d6f94c4df5 100644
--- a/contrib/libs/base64/ssse3/lib.c
+++ b/contrib/libs/base64/ssse3/lib.c
@@ -1,121 +1,121 @@
-#include <stdint.h>
-#include <stddef.h>
-
-#include "libbase64.h"
-#include "codecs.h"
-
-const uint8_t
-ssse3_base64_table_enc[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789+/";
-
-// In the lookup table below, note that the value for '=' (character 61) is
-// 254, not 255. This character is used for in-band signaling of the end of
-// the datastream, and we will use that later. The characters A-Z, a-z, 0-9
-// and + / are mapped to their "decoded" values. The other bytes all map to
-// the value 255, which flags them as "invalid input".
-
-const uint8_t
-ssse3_base64_table_dec[] =
-{
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 0..15
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 16..31
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 254, 62, 255, 63, // 32..47
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255, 254, 255, 255, // 48..63
- 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64..79
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 63, // 80..95
- 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96..111
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 255, 255, 255, 255, 255, // 112..127
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 128..143
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-};
-
-void
-ssse3_base64_stream_encode_init (struct ssse3_base64_state *state)
-{
- state->eof = 0;
- state->bytes = 0;
- state->carry = 0;
-}
-
-void
-ssse3_base64_stream_encode_final
- ( struct ssse3_base64_state *state
- , char *out
- , size_t *outlen
- )
-{
- uint8_t *o = (uint8_t *)out;
-
- if (state->bytes == 1) {
- *o++ = ssse3_base64_table_enc[state->carry];
- *o++ = '=';
- *o++ = '=';
- *outlen = 3;
- return;
- }
- if (state->bytes == 2) {
- *o++ = ssse3_base64_table_enc[state->carry];
- *o++ = '=';
- *outlen = 2;
- return;
- }
- *outlen = 0;
-}
-
-void
-ssse3_base64_stream_decode_init (struct ssse3_base64_state *state)
-{
- state->eof = 0;
- state->bytes = 0;
- state->carry = 0;
-}
-
-void
-ssse3_base64_encode
- ( const char *src
- , size_t srclen
- , char *out
- , size_t *outlen
- )
-{
- size_t s;
- size_t t;
- struct ssse3_base64_state state;
-
- // Init the stream reader:
- ssse3_base64_stream_encode_init(&state);
-
- // Feed the whole string to the stream reader:
- ssse3_base64_stream_encode(&state, src, srclen, out, &s);
-
- // Finalize the stream by writing trailer if any:
- ssse3_base64_stream_encode_final(&state, out + s, &t);
-
- // Final output length is stream length plus tail:
- *outlen = s + t;
-}
-
-int
-ssse3_base64_decode
- ( const char *src
- , size_t srclen
- , char *out
- , size_t *outlen
- )
-{
- struct ssse3_base64_state state;
-
- // Init the stream reader:
- ssse3_base64_stream_decode_init(&state);
-
- // Feed the whole string to the stream reader:
- return ssse3_base64_stream_decode(&state, src, srclen, out, outlen);
-}
+#include <stdint.h>
+#include <stddef.h>
+
+#include "libbase64.h"
+#include "codecs.h"
+
+const uint8_t
+ssse3_base64_table_enc[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789+/";
+
+// In the lookup table below, note that the value for '=' (character 61) is
+// 254, not 255. This character is used for in-band signaling of the end of
+// the datastream, and we will use that later. The characters A-Z, a-z, 0-9
+// and + / are mapped to their "decoded" values. The other bytes all map to
+// the value 255, which flags them as "invalid input".
+
+const uint8_t
+ssse3_base64_table_dec[] =
+{
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 0..15
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 16..31
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 254, 62, 255, 63, // 32..47
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255, 254, 255, 255, // 48..63
+ 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64..79
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 63, // 80..95
+ 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96..111
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 255, 255, 255, 255, 255, // 112..127
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 128..143
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+};
+
+void
+ssse3_base64_stream_encode_init (struct ssse3_base64_state *state)
+{
+ state->eof = 0;
+ state->bytes = 0;
+ state->carry = 0;
+}
+
+void
+ssse3_base64_stream_encode_final
+ ( struct ssse3_base64_state *state
+ , char *out
+ , size_t *outlen
+ )
+{
+ uint8_t *o = (uint8_t *)out;
+
+ if (state->bytes == 1) {
+ *o++ = ssse3_base64_table_enc[state->carry];
+ *o++ = '=';
+ *o++ = '=';
+ *outlen = 3;
+ return;
+ }
+ if (state->bytes == 2) {
+ *o++ = ssse3_base64_table_enc[state->carry];
+ *o++ = '=';
+ *outlen = 2;
+ return;
+ }
+ *outlen = 0;
+}
+
+void
+ssse3_base64_stream_decode_init (struct ssse3_base64_state *state)
+{
+ state->eof = 0;
+ state->bytes = 0;
+ state->carry = 0;
+}
+
+void
+ssse3_base64_encode
+ ( const char *src
+ , size_t srclen
+ , char *out
+ , size_t *outlen
+ )
+{
+ size_t s;
+ size_t t;
+ struct ssse3_base64_state state;
+
+ // Init the stream reader:
+ ssse3_base64_stream_encode_init(&state);
+
+ // Feed the whole string to the stream reader:
+ ssse3_base64_stream_encode(&state, src, srclen, out, &s);
+
+ // Finalize the stream by writing trailer if any:
+ ssse3_base64_stream_encode_final(&state, out + s, &t);
+
+ // Final output length is stream length plus tail:
+ *outlen = s + t;
+}
+
+int
+ssse3_base64_decode
+ ( const char *src
+ , size_t srclen
+ , char *out
+ , size_t *outlen
+ )
+{
+ struct ssse3_base64_state state;
+
+ // Init the stream reader:
+ ssse3_base64_stream_decode_init(&state);
+
+ // Feed the whole string to the stream reader:
+ return ssse3_base64_stream_decode(&state, src, srclen, out, outlen);
+}