aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ds/hashmap.c10
-rw-r--r--src/tester.c7
2 files changed, 8 insertions, 9 deletions
diff --git a/src/ds/hashmap.c b/src/ds/hashmap.c
index a08ce70..db09eac 100644
--- a/src/ds/hashmap.c
+++ b/src/ds/hashmap.c
@@ -27,29 +27,29 @@ static void *hdr2hm(Header *hdr) {
}
static int filled(const void *hm, size_t i) {
- return hm2hdr(hm)->filled_dead_map[i / 8] & (1 << (i % 8 + 8));
+ return hm2hdr(hm)->filled_dead_map[i / 8] & (1u << (i % 8 + 8));
}
static void fill(void *hm, size_t i) {
Header *hdr = hm2hdr(hm);
hdr->n_filled++;
- hdr->filled_dead_map[i / 8] |= (1 << (i % 8 + 8));
+ hdr->filled_dead_map[i / 8] |= (1u << (i % 8 + 8));
}
static int dead(const void *hm, size_t i) {
- return hm2hdr(hm)->filled_dead_map[i / 8] & (1 << i % 8);
+ return hm2hdr(hm)->filled_dead_map[i / 8] & (1u << i % 8);
}
static void kill(void *hm, size_t i) {
Header *hdr = hm2hdr(hm);
hdr->n_dead++;
- hdr->filled_dead_map[i / 8] |= (1 << i % 8);
+ hdr->filled_dead_map[i / 8] |= (1u << i % 8);
}
static void unkill(void *hm, size_t i) {
Header *hdr = hm2hdr(hm);
hdr->n_dead--;
- hdr->filled_dead_map[i / 8] &= ~(1 << i % 8);
+ hdr->filled_dead_map[i / 8] &= ~(1u << i % 8);
}
// FNV-1a
diff --git a/src/tester.c b/src/tester.c
index f6df372..7723e97 100644
--- a/src/tester.c
+++ b/src/tester.c
@@ -7,9 +7,9 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/wait.h>
#ifndef _WIN32
+#include <sys/wait.h>
#include <unistd.h>
#define mos_close close
#define mos_isatty isatty
@@ -48,9 +48,8 @@ static Outputs suppressed = {
};
#define print_color(color, ...) \
- (mos_isatty(STDOUT_FILENO) \
- ? (printf("\033[%dm", color), printf(__VA_ARGS__), printf("\033[0m")) \
- : printf(__VA_ARGS__))
+ (mos_isatty(1) ? (printf("\033[%dm", color), printf(__VA_ARGS__), printf("\033[0m")) \
+ : printf(__VA_ARGS__))
#define nl printf("\n")
static void print_center(const char *text, int color, char padding_char) {