diff options
| author | 2022-04-25 07:09:18 -0700 | |
|---|---|---|
| committer | 2022-04-25 07:09:18 -0700 | |
| commit | 2c6e5c3fc4a7255eb29f7ae618d2826dd9a7d5e5 (patch) | |
| tree | 1de65b5cc11b7a479f92f853980d6a8ee640c9e6 /src/base64/fastavxbase64.h | |
| parent | 4b4df5095ea756388df4c26683ab0bb222750ed3 (diff) | |
| download | bun-2c6e5c3fc4a7255eb29f7ae618d2826dd9a7d5e5.tar.gz bun-2c6e5c3fc4a7255eb29f7ae618d2826dd9a7d5e5.tar.zst bun-2c6e5c3fc4a7255eb29f7ae618d2826dd9a7d5e5.zip | |
some of buffer
Diffstat (limited to '')
| -rw-r--r-- | src/base64/fastavxbase64.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/base64/fastavxbase64.h b/src/base64/fastavxbase64.h new file mode 100644 index 000000000..d1064a5d1 --- /dev/null +++ b/src/base64/fastavxbase64.h @@ -0,0 +1,41 @@ +#if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) + +#ifndef EXPAVX_B64 +#define EXPAVX_B64 + +/** + * Assumes recent x64 hardware with AVX2 instructions. + */ + +#include "chromiumbase64.h" +#include <stddef.h> +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * This code extends Nick Galbreath's high performance base 64decoder (used in + * Chromium), the API is the same effectively, see chromium64.h. + */ + +/* + * AVX2 accelerated version of Galbreath's chromium_base64_decode function + * Usage remains the same, see chromium.h. + */ +size_t fast_avx2_base64_decode(char *out, const char *src, size_t srclen, + size_t *outlen); + +/* + * AVX2 accelerated version of Galbreath's chromium_base64_encode function + * Usage remains the same, see chromium.h. + */ +size_t fast_avx2_base64_encode(char *dest, const char *str, size_t len); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif +#endif
\ No newline at end of file |
