mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 07:29:23 +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
|
@ -84,7 +84,8 @@
|
|||
/* clang-format on */
|
||||
#elif defined(__LINKER__)
|
||||
|
||||
#define BCX_NIBBLE(X) ((((X)&0xf) > 0x9) ? ((X)&0xf) + 0x37 : ((X)&0xf) + 0x30)
|
||||
#define BCX_NIBBLE(X) \
|
||||
((((X) & 0xf) > 0x9) ? ((X) & 0xf) + 0x37 : ((X) & 0xf) + 0x30)
|
||||
#define BCX_OCTET(X) ((BCX_NIBBLE((X) >> 4) << 8) | (BCX_NIBBLE((X) >> 0) << 0))
|
||||
#define BCX_INT16(X) ((BCX_OCTET((X) >> 8) << 16) | (BCX_OCTET((X) >> 0) << 0))
|
||||
#define BCXSTUB(SYM, X) \
|
||||
|
|
|
@ -50,11 +50,13 @@ 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;
|
||||
}
|
||||
|
@ -62,7 +64,8 @@ struct magicu __magicu_get(uint32_t d) {
|
|||
} 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
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ char *GetInterpreterExecutableName(char *p, size_t n) {
|
|||
p[rc] = 0;
|
||||
return p;
|
||||
} else if (IsFreebsd() || IsNetbsd()) {
|
||||
// clang-format off
|
||||
cmd[0] = 1; // CTL_KERN
|
||||
cmd[1] = 14; // KERN_PROC
|
||||
if (IsFreebsd()) { //
|
||||
|
@ -76,6 +77,7 @@ char *GetInterpreterExecutableName(char *p, size_t n) {
|
|||
cmd[2] = 5; // KERN_PROC_PATHNAME
|
||||
} //
|
||||
cmd[3] = -1; // current process
|
||||
// clang-format on
|
||||
if (sysctl(cmd, ARRAYLEN(cmd), p, &n, 0, 0) != -1) {
|
||||
errno = e;
|
||||
return p;
|
||||
|
|
|
@ -44,7 +44,9 @@ COSMOPOLITAN_C_START_
|
|||
#define PTHREAD_COND_INITIALIZER _PTHREAD_INIT
|
||||
#define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_INIT
|
||||
#define PTHREAD_MUTEX_INITIALIZER _PTHREAD_INIT
|
||||
#define _PTHREAD_INIT {0}
|
||||
|
||||
#define _PTHREAD_INIT \
|
||||
{ 0 }
|
||||
|
||||
typedef uintptr_t pthread_t;
|
||||
typedef int pthread_id_np_t;
|
||||
|
|
|
@ -117,7 +117,14 @@ main()
|
|||
}
|
||||
|
||||
{
|
||||
struct A { int* p = &g; A() {++*p; } };
|
||||
struct A
|
||||
{
|
||||
int* p = &g;
|
||||
A()
|
||||
{
|
||||
++*p;
|
||||
}
|
||||
};
|
||||
ctl::optional<A> x;
|
||||
if (g != 0)
|
||||
return 25;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/intrin/magicu.h"
|
||||
|
||||
#define T uint32_t
|
||||
#define TBIT (sizeof(T) * CHAR_BIT - 1)
|
||||
|
|
|
@ -49,7 +49,8 @@ long unsharp(long cn, long yw, long xw, unsigned char img[cn][yw][xw], long yn,
|
|||
}
|
||||
if (y < yn) {
|
||||
for (x = 0; x < xn; ++x) {
|
||||
(*t)[y % 3][x] = CONVOLVE5X5(/* clang-format off */
|
||||
(*t)[y % 3][x] =
|
||||
CONVOLVE5X5(/* clang-format off */
|
||||
7, (-1 / 256.), img[c],
|
||||
1, 4, 6, 4, 1,
|
||||
4, 16, 24, 16, 4,
|
||||
|
|
Loading…
Add table
Reference in a new issue