shithub: gefs

Download patch

ref: 076b2649290d831a8f67ae58e0add8cb1e3750e2
parent: fa848c5023115801abfed9634d1b465e155f5c59
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Jan 2 10:07:55 EST 2024

main: make trace sizes unsigned, use and instead of mod

--- a/main.c
+++ b/main.c
@@ -33,10 +33,10 @@
 _trace(char *msg, Bptr bp, vlong v0, vlong v1)
 {
 	Trace *t;
-	int idx;
+	ulong idx;
 
 	idx = aincl(&fs->traceidx, 1);
-	t = &fs->trace[(idx-1) % fs->tracesz];
+	t = &fs->trace[(idx-1) & ~(fs->tracesz-1)];
 	strecpy(t->msg, t->msg+sizeof(t->msg), msg);
 	t->tid = (*errctx)->tid;
 	t->qgen = agetv(&fs->qgen);