Clean up some code

This commit is contained in:
Justine Tunney 2022-12-11 14:30:50 -08:00
parent 531bfbd61f
commit ed161b240e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
17 changed files with 107 additions and 182 deletions

View file

@ -469,7 +469,7 @@ int64_t Ror32(uint64_t x64, uint64_t y, uint32_t *f) {
uint32_t x = x64;
if ((y &= 31)) {
x = x >> y | x << (32 - y);
return RotateFlags(x, x >> 31, f, (x >> 31) ^ (x >> 30) & 1);
return RotateFlags(x, x >> 31, f, ((x >> 31) ^ (x >> 30)) & 1);
} else {
return x;
}
@ -478,7 +478,7 @@ int64_t Ror32(uint64_t x64, uint64_t y, uint32_t *f) {
int64_t Ror64(uint64_t x, uint64_t y, uint32_t *f) {
if ((y &= 63)) {
x = x >> y | x << (64 - y);
return RotateFlags(x, x >> 63, f, (x >> 63) ^ (x >> 62) & 1);
return RotateFlags(x, x >> 63, f, ((x >> 63) ^ (x >> 62)) & 1);
} else {
return x;
}
@ -498,7 +498,7 @@ int64_t Ror8(uint64_t x64, uint64_t y, uint32_t *f) {
uint8_t x = x64;
if (y & 31) {
if ((y &= 7)) x = x >> y | x << (8 - y);
return RotateFlags(x, x >> 7, f, (x >> 7) ^ (x >> 6) & 1);
return RotateFlags(x, x >> 7, f, ((x >> 7) ^ (x >> 6)) & 1);
} else {
return x;
}
@ -756,7 +756,7 @@ int64_t Ror16(uint64_t x64, uint64_t y, uint32_t *f) {
uint16_t x = x64;
if (y & 31) {
if ((y &= 15)) x = x >> y | x << (16 - y);
return RotateFlags(x, x >> 15, f, (x >> 15) ^ (x >> 14) & 1);
return RotateFlags(x, x >> 15, f, ((x >> 15) ^ (x >> 14)) & 1);
} else {
return x;
}

View file

@ -19,6 +19,7 @@
#include "libc/fmt/bing.internal.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/tpenc.h"
#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/mem/arraylist2.internal.h"
#include "libc/mem/mem.h"
@ -90,7 +91,7 @@ static char *DisAddr(struct Dis *d, char *p) {
int64_t x = d->addr;
if (0 <= x && x < 0x10fff0) {
return p + uint64toarray_fixed16(x, p, 24);
} else if (-2147483648 <= x && x <= 2147483647) {
} else if (INT_MIN <= x && x <= INT_MAX) {
return p + uint64toarray_fixed16(x, p, 32);
} else {
return p + uint64toarray_fixed16(x, p, 48);

View file

@ -186,8 +186,9 @@ long DisFindSym(struct Dis *d, int64_t addr) {
l = m + 1;
}
}
if (r && d->syms.p[r - 1].addr < 256) {
/* XXX: prevent skewed binbase from doing weirdness */
// TODO(jart): This was <256 but that broke SectorLISP debugging
// Why did the Cosmo binbase bootloader need this?
if (r && d->syms.p[r - 1].addr < 32) {
return -1;
}
if (r && (addr == d->syms.p[r - 1].addr ||