Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: fusl/src/misc/a64l.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include <stdlib.h> 1 #include <stdlib.h>
2 #include <string.h> 2 #include <string.h>
3 #include <stdint.h> 3 #include <stdint.h>
4 4
5 static const char digits[] = 5 static const char digits[] =
6 » "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 6 "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
7 7
8 long a64l(const char *s) 8 long a64l(const char* s) {
9 { 9 int e;
10 » int e; 10 uint32_t x = 0;
11 » uint32_t x = 0; 11 for (e = 0; e < 36 && *s; e += 6, s++)
12 » for (e=0; e<36 && *s; e+=6, s++) 12 x |= (strchr(digits, *s) - digits) << e;
13 » » x |= (strchr(digits, *s)-digits)<<e; 13 return x;
14 » return x;
15 } 14 }
16 15
17 char *l64a(long x0) 16 char* l64a(long x0) {
18 { 17 static char s[7];
19 » static char s[7]; 18 char* p;
20 » char *p; 19 uint32_t x = x0;
21 » uint32_t x = x0; 20 for (p = s; x; p++, x >>= 6)
22 » for (p=s; x; p++, x>>=6) 21 *p = digits[x & 63];
23 » » *p = digits[x&63]; 22 *p = 0;
24 » *p = 0; 23 return s;
25 » return s;
26 } 24 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698