Skip to content

Commit 5dd7ddb

Browse files
committed
Remove bad defines from early days of project
These definitions were causing issues with building LLVM. It is possible they also caused crashes we've seen with our MacOS ARM64 OpenMP support.
1 parent f25fbba commit 5dd7ddb

File tree

20 files changed

+568
-140
lines changed

20 files changed

+568
-140
lines changed

dsp/core/core.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ int mulaw(int);
99
int unmulaw(int);
1010
void *double2byte(long, const void *, double, double) vallocesque;
1111
void *byte2double(long, const void *, double, double) vallocesque;
12-
void *dct(float[restrict hasatleast 8][8], unsigned, float, float, float, float,
13-
float);
14-
void *dctjpeg(float[restrict hasatleast 8][8], unsigned);
12+
void *dct(float[hasatleast 8][8], unsigned, float, float, float, float, float);
13+
void *dctjpeg(float[hasatleast 8][8], unsigned);
1514
double det3(const double[3][3]) nosideeffect;
16-
void *inv3(double[restrict 3][3], const double[restrict 3][3], double);
17-
void *matmul3(double[restrict 3][3], const double[3][3], const double[3][3]);
18-
void *vmatmul3(double[restrict 3], const double[3], const double[3][3]);
19-
void *matvmul3(double[restrict 3], const double[3][3], const double[3]);
15+
void *inv3(double[3][3], const double[3][3], double);
16+
void *matmul3(double[3][3], const double[3][3], const double[3][3]);
17+
void *vmatmul3(double[3], const double[3], const double[3][3]);
18+
void *matvmul3(double[3], const double[3][3], const double[3]);
2019
double rgb2stdtv(double) pureconst;
2120
double rgb2lintv(double) pureconst;
2221
double rgb2stdpc(double, double) pureconst;

dsp/core/dct.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
*
6666
* @cost ~100ns
6767
*/
68-
void *dct(float M[restrict hasatleast 8][8], unsigned stride, float c0,
69-
float c1, float c2, float c3, float c4) {
68+
void *dct(float M[hasatleast 8][8], unsigned stride, float c0, float c1,
69+
float c2, float c3, float c4) {
7070
unsigned y, x;
7171
for (y = 0; y < stride * 8; y += stride) {
7272
DCT(M[y][0], M[y][1], M[y][2], M[y][3], M[y][4], M[y][5], M[y][6], M[y][7],
@@ -79,7 +79,7 @@ void *dct(float M[restrict hasatleast 8][8], unsigned stride, float c0,
7979
return M;
8080
}
8181

82-
void *dctjpeg(float M[restrict hasatleast 8][8], unsigned stride) {
82+
void *dctjpeg(float M[hasatleast 8][8], unsigned stride) {
8383
return dct(M, stride, .707106781f, .382683433f, .541196100f, 1.306562965f,
8484
.707106781f);
8585
}

dsp/core/inv3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* @define 𝐀⁻¹=𝐁 such that 𝐀×𝐁=𝐁×𝐀=𝐈ₙ
3131
* @see det3()
3232
*/
33-
void *inv3(double B[restrict 3][3], const double A[restrict 3][3], double d) {
33+
void *inv3(double B[3][3], const double A[3][3], double d) {
3434
d = d ? 1 / d : NAN;
3535
B[0][0] = (A[1][1] * A[2][2] - A[2][1] * A[1][2]) * d;
3636
B[0][1] = (A[2][1] * A[0][2] - A[0][1] * A[2][2]) * d;

dsp/core/matmul3.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
/**
2323
* Multiplies 3×3 matrices.
2424
*/
25-
void *matmul3(double R[restrict 3][3], const double A[3][3],
26-
const double B[3][3]) {
25+
void *matmul3(double R[3][3], const double A[3][3], const double B[3][3]) {
2726
int i, j, k;
2827
memset(R, 0, sizeof(double) * 3 * 3);
2928
for (i = 0; i < 3; ++i) {

dsp/core/matvmul3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* @see vmatmul3() for noncommutative corollary
2525
*/
26-
void *matvmul3(double R[restrict 3], const double M[3][3], const double V[3]) {
26+
void *matvmul3(double R[3], const double M[3][3], const double V[3]) {
2727
R[0] = V[0] * M[0][0] + V[1] * M[0][1] + V[2] * M[0][2];
2828
R[1] = V[0] * M[1][0] + V[1] * M[1][1] + V[2] * M[1][2];
2929
R[2] = V[0] * M[2][0] + V[1] * M[2][1] + V[2] * M[2][2];

dsp/core/vmatmul3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* @see matvmul3() for noncommutative corollary
2525
*/
26-
void *vmatmul3(double R[restrict 3], const double V[3], const double M[3][3]) {
26+
void *vmatmul3(double R[3], const double V[3], const double M[3][3]) {
2727
R[0] = V[0] * M[0][0] + V[1] * M[1][0] + V[2] * M[2][0];
2828
R[1] = V[0] * M[0][1] + V[1] * M[1][1] + V[2] * M[2][1];
2929
R[2] = V[0] * M[0][2] + V[1] * M[1][2] + V[2] * M[2][2];

dsp/mpeg/macroblock.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@
3131
#include "dsp/mpeg/video.h"
3232
#include "libc/log/check.h"
3333

34-
forceinline void plm_video_process_macroblock(plm_video_t *self,
35-
uint8_t *restrict d,
36-
uint8_t *restrict s, int motion_h,
34+
forceinline void plm_video_process_macroblock(plm_video_t *self, uint8_t *d,
35+
uint8_t *s, int motion_h,
3736
int motion_v, bool interpolate,
3837
unsigned BW) {
3938
unsigned si, di, max_address;
@@ -155,17 +154,17 @@ forceinline void plm_video_process_macroblock(plm_video_t *self,
155154
}
156155
}
157156

158-
void plm_video_process_macroblock_8(plm_video_t *self, uint8_t *restrict d,
159-
uint8_t *restrict s, int motion_h,
160-
int motion_v, bool interpolate) {
157+
void plm_video_process_macroblock_8(plm_video_t *self, uint8_t *d, uint8_t *s,
158+
int motion_h, int motion_v,
159+
bool interpolate) {
161160
DCHECK_ALIGNED(8, d);
162161
DCHECK_ALIGNED(8, s);
163162
plm_video_process_macroblock(self, d, s, motion_h, motion_v, interpolate, 8);
164163
}
165164

166-
void plm_video_process_macroblock_16(plm_video_t *self, uint8_t *restrict d,
167-
uint8_t *restrict s, int motion_h,
168-
int motion_v, bool interpolate) {
165+
void plm_video_process_macroblock_16(plm_video_t *self, uint8_t *d, uint8_t *s,
166+
int motion_h, int motion_v,
167+
bool interpolate) {
169168
DCHECK_ALIGNED(16, d);
170169
DCHECK_ALIGNED(16, s);
171170
plm_video_process_macroblock(self, d, s, motion_h, motion_v, interpolate, 16);

dsp/mpeg/video.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ typedef struct plm_video_t {
5151
int assume_no_b_frames;
5252
} plm_video_t;
5353

54-
void plm_video_process_macroblock_8(plm_video_t *, uint8_t *restrict,
55-
uint8_t *restrict, int, int, bool);
56-
void plm_video_process_macroblock_16(plm_video_t *, uint8_t *restrict,
57-
uint8_t *restrict, int, int, bool);
54+
void plm_video_process_macroblock_8(plm_video_t *, uint8_t *, uint8_t *, int,
55+
int, bool);
56+
void plm_video_process_macroblock_16(plm_video_t *, uint8_t *, uint8_t *, int,
57+
int, bool);
5858

5959
COSMOPOLITAN_C_END_
6060
#endif /* COSMOPOLITAN_DSP_MPEG_VIDEO_H_ */

dsp/scale/gyarados.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ struct SamplingSolution {
5353
static double ComputeWeight(double x) {
5454
if (-1.5 < x && x < 1.5) {
5555
if (-.5 < x && x < .5) {
56-
return .75 - SQR(x);
56+
return.75 - SQR(x);
5757
} else if (x < 0) {
58-
return .5 * SQR(x + 1.5);
58+
return.5 * SQR(x + 1.5);
5959
} else {
60-
return .5 * SQR(x - 1.5);
60+
return.5 * SQR(x - 1.5);
6161
}
6262
} else {
6363
return 0;
@@ -149,12 +149,11 @@ static int Sharpen(int ax, int bx, int cx) {
149149

150150
static void GyaradosImpl(long dyw, long dxw, int dst[dyw][dxw], long syw,
151151
long sxw, const int src[syw][sxw], long dyn, long dxn,
152-
long syn, long sxn, int tmp0[restrict dyn][sxn],
153-
int tmp1[restrict dyn][sxn],
154-
int tmp2[restrict dyn][dxn], long yfn, long xfn,
155-
const short fyi[dyn][yfn], const short fyw[dyn][yfn],
156-
const short fxi[dxn][xfn], const short fxw[dxn][xfn],
157-
bool sharpen) {
152+
long syn, long sxn, int tmp0[dyn][sxn],
153+
int tmp1[dyn][sxn], int tmp2[dyn][dxn], long yfn,
154+
long xfn, const short fyi[dyn][yfn],
155+
const short fyw[dyn][yfn], const short fxi[dxn][xfn],
156+
const short fxw[dxn][xfn], bool sharpen) {
158157
long i;
159158
int eax, dy, dx, sx;
160159
for (sx = 0; sx < sxn; ++sx) {

dsp/scale/magikarp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ void *Magkern2xY(long ys, long xs, unsigned char p[ys][xs], long yn, long xn) {
106106
return p;
107107
}
108108

109-
void *MagikarpY(long dys, long dxs, unsigned char d[restrict dys][dxs],
110-
long sys, long sxs, const unsigned char s[sys][sxs], long yn,
111-
long xn, const signed char K[8]) {
109+
void *MagikarpY(long dys, long dxs, unsigned char d[dys][dxs], long sys,
110+
long sxs, const unsigned char s[sys][sxs], long yn, long xn,
111+
const signed char K[8]) {
112112
long y, x;
113113
for (y = 0; y < yn; ++y) {
114114
for (x = 0; x < xn; ++x) {

0 commit comments

Comments
 (0)