summaryrefslogtreecommitdiff
path: root/src/support/base64.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-04-26 16:59:41 -0700
committerGitHub <noreply@github.com>2019-04-26 16:59:41 -0700
commitdb9124f1de0478dcac525009b6f1589b44a7edd8 (patch)
treefa26395a0f6cca53cf5cb6e10189f989c5bfa847 /src/support/base64.h
parent87636dccd404a340d75acb1d96301581343f29ca (diff)
downloadbinaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.gz
binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.bz2
binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.zip
Apply format changes from #2048 (#2059)
Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
Diffstat (limited to 'src/support/base64.h')
-rw-r--r--src/support/base64.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/support/base64.h b/src/support/base64.h
index 0c87c37c1..8634246a6 100644
--- a/src/support/base64.h
+++ b/src/support/base64.h
@@ -21,20 +21,18 @@
#include <string>
#include <vector>
-inline std::string base64Encode(std::vector<char> &data) {
+inline std::string base64Encode(std::vector<char>& data) {
std::string ret;
size_t i = 0;
- const char* alphabet =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789+/";
+ const char* alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789+/";
while (i + 3 <= data.size()) {
- uint32_t bits =
- (((uint32_t)(uint8_t) data[i + 0]) << 16) |
- (((uint32_t)(uint8_t) data[i + 1]) << 8) |
- (((uint32_t)(uint8_t) data[i + 2]) << 0);
+ uint32_t bits = (((uint32_t)(uint8_t)data[i + 0]) << 16) |
+ (((uint32_t)(uint8_t)data[i + 1]) << 8) |
+ (((uint32_t)(uint8_t)data[i + 2]) << 0);
ret += alphabet[(bits >> 18) & 0x3f];
ret += alphabet[(bits >> 12) & 0x3f];
ret += alphabet[(bits >> 6) & 0x3f];
@@ -43,15 +41,14 @@ inline std::string base64Encode(std::vector<char> &data) {
}
if (i + 2 == data.size()) {
- uint32_t bits =
- (((uint32_t)(uint8_t) data[i + 0]) << 8) |
- (((uint32_t)(uint8_t) data[i + 1]) << 0);
+ uint32_t bits = (((uint32_t)(uint8_t)data[i + 0]) << 8) |
+ (((uint32_t)(uint8_t)data[i + 1]) << 0);
ret += alphabet[(bits >> 10) & 0x3f];
ret += alphabet[(bits >> 4) & 0x3f];
ret += alphabet[(bits << 2) & 0x3f];
ret += '=';
} else if (i + 1 == data.size()) {
- uint32_t bits = (uint32_t)(uint8_t) data[i + 0];
+ uint32_t bits = (uint32_t)(uint8_t)data[i + 0];
ret += alphabet[(bits >> 2) & 0x3f];
ret += alphabet[(bits << 4) & 0x3f];
ret += '=';