summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2025-04-15 14:48:55 +0200
committerJesper Jensen <jesper@jnsn.dev>2025-04-15 14:48:55 +0200
commit78a6d2ec1fb9c61cda1a8bcdc3843b159cdd850c (patch)
tree2888ca6f4810c8e289572a645aa235a219f24c83
parent6386a3eb9628315e23e16637ea5d29e72b053f0f (diff)
Reformat target generation
I think this reads nicer
-rw-r--r--src/routing.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/routing.c b/src/routing.c
index eca84f9..edffffc 100644
--- a/src/routing.c
+++ b/src/routing.c
@@ -136,8 +136,9 @@ static uint8_t rand_byte() {
struct nodeid rand_nodeid_in_bucket(struct nodeid *self, struct nodeid *other) {
struct nodeid target;
- for(uint8_t *target_byte = (uint8_t*)&target; target_byte < ((uint8_t*)&target)+sizeof(target); target_byte++) {
- *target_byte = rand_byte();
+ {
+ char *target_byte = (char*)&target;
+ for(size_t i = 0; i < sizeof(target); i++) (*target_byte++) = rand_byte();
}
uint8_t bucket = prefix(self, other);