mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-04 00:40:27 +00:00
Rerun clang-format on the repo (#1217)
🚨 clang-format changes output per version!
This is with version 19.0.0. The modifications seem to be fixing the old
version’s errors - mainly involving omitted whitespace around binary ops
and inserted whitespace between goto labels and colons (if followed by a
curly brace.)
Also fixes a few mistakes made by e.g. someone (ahem) forgetting to pass
his ctl/string.h modifications through it.
We should add this to .git-blame-ignore-revs once we have its final hash
on master.
This commit is contained in:
parent
8e37ee2598
commit
89fc95fefd
38 changed files with 139 additions and 122 deletions
|
@ -25,7 +25,7 @@
|
|||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/winargs.internal.h"
|
||||
|
||||
#define UNSHADOW(x) ((int64_t)(MAX(0, (x)-0x7fff8000)) << 3)
|
||||
#define UNSHADOW(x) ((int64_t)(MAX(0, (x) - 0x7fff8000)) << 3)
|
||||
#define FRAME(x) ((int)((x) >> 16))
|
||||
|
||||
static const char *GetFrameName(int x) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
#define asint(x) ((union pun){x}).i
|
||||
#define isnan(x) (((x)&0x7fff) > 0x7c00)
|
||||
#define isnan(x) (((x) & 0x7fff) > 0x7c00)
|
||||
|
||||
union pun {
|
||||
_Float16 f;
|
||||
|
|
|
@ -50,19 +50,22 @@ struct magicu __magicu_get(uint32_t d) {
|
|||
p32 = 2 * p32;
|
||||
}
|
||||
if (r + 1 >= d - r) {
|
||||
if (q >= 0x7FFFFFFF) a = 1;
|
||||
if (q >= 0x7FFFFFFF)
|
||||
a = 1;
|
||||
q = 2 * q + 1; // Update q.
|
||||
r = 2 * r + 1 - d; // Update r.
|
||||
} else {
|
||||
if (q >= 0x80000000) a = 1;
|
||||
if (q >= 0x80000000)
|
||||
a = 1;
|
||||
q = 2 * q;
|
||||
r = 2 * r + 1;
|
||||
}
|
||||
delta = d - 1 - r;
|
||||
} while (p < 64 && p32 < delta);
|
||||
magu.M = q + 1; // Magic number and
|
||||
magu.s = p - 32; // Shift amount to return
|
||||
if (a) magu.s |= 64; // Sets "add" indicator
|
||||
magu.M = q + 1; // Magic number and
|
||||
magu.s = p - 32; // Shift amount to return
|
||||
if (a)
|
||||
magu.s |= 64; // Sets "add" indicator
|
||||
npassert(magu.M || magu.s); // Never returns zero.
|
||||
return magu;
|
||||
}
|
||||
|
|
|
@ -24,8 +24,10 @@ forceinline uint32_t __magicu_div(uint32_t x, struct magicu d) {
|
|||
* Checks if 𝑑 contains a valid initialized divisor.
|
||||
*/
|
||||
static inline bool32 __magicu_valid(struct magicu d) {
|
||||
if (!d.M && !d.s) return false; /* uninitialized */
|
||||
if (d.s & ~(64 | 63)) return false; /* corrupted */
|
||||
if (!d.M && !d.s)
|
||||
return false; /* uninitialized */
|
||||
if (d.s & ~(64 | 63))
|
||||
return false; /* corrupted */
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#ifdef __x86_64__
|
||||
|
||||
#define INVERT(x) (BANE + PHYSICAL((uintptr_t)(x)))
|
||||
#define NOPAGE ((uint64_t)-1)
|
||||
#define NOPAGE ((uint64_t) - 1)
|
||||
|
||||
#define APE_STACK_VADDR \
|
||||
({ \
|
||||
|
|
|
@ -8,36 +8,36 @@ void palignr(void *, const void *, const void *, unsigned long);
|
|||
|
||||
#if !defined(__STRICT_ANSI__) && !defined(__chibicc__) && defined(__x86_64__)
|
||||
__intrin_xmm_t __palignrs(__intrin_xmm_t, __intrin_xmm_t);
|
||||
#define palignr(C, B, A, I) \
|
||||
do { \
|
||||
if (__builtin_expect(!IsModeDbg() && X86_NEED(SSE) && X86_HAVE(SSSE3), \
|
||||
1)) { \
|
||||
__intrin_xmm_t *Xmm0 = (void *)(C); \
|
||||
const __intrin_xmm_t *Xmm1 = (const __intrin_xmm_t *)(B); \
|
||||
const __intrin_xmm_t *Xmm2 = (const __intrin_xmm_t *)(A); \
|
||||
if (__builtin_constant_p(I)) { \
|
||||
if (!X86_NEED(AVX)) { \
|
||||
asm("palignr\t%2,%1,%0" \
|
||||
: "=x"(*Xmm0) \
|
||||
: "x"(*Xmm2), "i"(I), "0"(*Xmm1)); \
|
||||
} else { \
|
||||
asm("vpalignr\t%3,%2,%1,%0" \
|
||||
: "=x"(*Xmm0) \
|
||||
: "x"(*Xmm1), "x"(*Xmm2), "i"(I)); \
|
||||
} \
|
||||
} else { \
|
||||
unsigned long Vimm = (I); \
|
||||
typeof(__palignrs) *Fn; \
|
||||
if (__builtin_expect(Vimm < 32, 1)) { \
|
||||
Fn = (typeof(__palignrs) *)((uintptr_t)&__palignrs + Vimm * 8); \
|
||||
*Xmm0 = Fn(*Xmm1, *Xmm2); \
|
||||
} else { \
|
||||
memset(Xmm0, 0, 16); \
|
||||
} \
|
||||
} \
|
||||
} else { \
|
||||
palignr(C, B, A, I); \
|
||||
} \
|
||||
#define palignr(C, B, A, I) \
|
||||
do { \
|
||||
if (__builtin_expect(!IsModeDbg() && X86_NEED(SSE) && X86_HAVE(SSSE3), \
|
||||
1)) { \
|
||||
__intrin_xmm_t *Xmm0 = (void *)(C); \
|
||||
const __intrin_xmm_t *Xmm1 = (const __intrin_xmm_t *)(B); \
|
||||
const __intrin_xmm_t *Xmm2 = (const __intrin_xmm_t *)(A); \
|
||||
if (__builtin_constant_p(I)) { \
|
||||
if (!X86_NEED(AVX)) { \
|
||||
asm("palignr\t%2,%1,%0" \
|
||||
: "=x"(*Xmm0) \
|
||||
: "x"(*Xmm2), "i"(I), "0"(*Xmm1)); \
|
||||
} else { \
|
||||
asm("vpalignr\t%3,%2,%1,%0" \
|
||||
: "=x"(*Xmm0) \
|
||||
: "x"(*Xmm1), "x"(*Xmm2), "i"(I)); \
|
||||
} \
|
||||
} else { \
|
||||
unsigned long Vimm = (I); \
|
||||
typeof(__palignrs) *Fn; \
|
||||
if (__builtin_expect(Vimm < 32, 1)) { \
|
||||
Fn = (typeof(__palignrs) *)((uintptr_t) & __palignrs + Vimm * 8); \
|
||||
*Xmm0 = Fn(*Xmm1, *Xmm2); \
|
||||
} else { \
|
||||
memset(Xmm0, 0, 16); \
|
||||
} \
|
||||
} \
|
||||
} else { \
|
||||
palignr(C, B, A, I); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ static __vex size_t __strlen(const char *s) {
|
|||
m = __builtin_ia32_pmovmskb128(*++p == z);
|
||||
return (const char *)p + __builtin_ctzl(m) - s;
|
||||
#else
|
||||
#define ONES ((word)-1 / 255)
|
||||
#define ONES ((word) - 1 / 255)
|
||||
#define BANE (ONES * (255 / 2 + 1))
|
||||
typedef unsigned long mayalias word;
|
||||
word w;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue