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

Side by Side Diff: fusl/src/temp/__randname.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 <time.h> 1 #include <time.h>
2 #include <stdint.h> 2 #include <stdint.h>
3 3
4 int __clock_gettime(clockid_t, struct timespec *); 4 int __clock_gettime(clockid_t, struct timespec*);
5 5
6 /* This assumes that a check for the 6 /* This assumes that a check for the
7 template size has already been made */ 7 template size has already been made */
8 char *__randname(char *template) 8 char* __randname(char* template) {
9 { 9 int i;
10 » int i; 10 struct timespec ts;
11 » struct timespec ts; 11 unsigned long r;
12 » unsigned long r;
13 12
14 » __clock_gettime(CLOCK_REALTIME, &ts); 13 __clock_gettime(CLOCK_REALTIME, &ts);
15 » r = ts.tv_nsec*65537 ^ (uintptr_t)&ts / 16 + (uintptr_t)template; 14 r = ts.tv_nsec * 65537 ^ (uintptr_t)&ts / 16 + (uintptr_t) template;
16 » for (i=0; i<6; i++, r>>=5) 15 for (i = 0; i < 6; i++, r >>= 5)
17 » » template[i] = 'A'+(r&15)+(r&16)*2; 16 template[i] = 'A' + (r & 15) + (r & 16) * 2;
18 17
19 » return template; 18 return template;
20 } 19 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698