diff --git a/src/ase.c b/src/ase.c index cc23731b..1c5d85af 100644 --- a/src/ase.c +++ b/src/ase.c @@ -341,7 +341,7 @@ INTERNAL void inflate(u8 *dst, u8 *encoded) struct huffman lit_len_huffman = huffman_init(temp.arena, 15, lit_len_dist_table, hlit); struct huffman dist_huffman = huffman_init(temp.arena, 15, lit_len_dist_table + hlit, hdist); - while (1) { + for (;;) { u32 lit_len = huffman_decode(&lit_len_huffman, &bb); if (lit_len <= 255) { *dst++ = lit_len & 0xFF; diff --git a/src/asset_cache.c b/src/asset_cache.c index 879e1ff8..a2109bcf 100644 --- a/src/asset_cache.c +++ b/src/asset_cache.c @@ -70,7 +70,7 @@ INTERNAL struct asset *asset_cache_get_slot_locked(struct snc_lock *lock, struct (UNUSED)lock; u64 index = hash % countof(G.lookup); - while (1) { + for (;;) { struct asset *slot = &G.lookup[index]; if (slot->hash) { /* Occupied */ diff --git a/src/collider.c b/src/collider.c index 29dc942a..5cb0a2f4 100644 --- a/src/collider.c +++ b/src/collider.c @@ -171,7 +171,7 @@ INTERNAL struct gjk_result gjk_get_simplex(struct collider_shape *shape0, struct struct v2 removed_a = ZI; struct v2 removed_b = ZI; u32 num_removed = 0; - while (1) { + for (;;) { if (s.len == 1) { /* Second point is support point towards origin */ dir = v2_neg(s.a.p); @@ -346,7 +346,7 @@ INTERNAL struct epa_result epa_get_normal_from_gjk(struct collider_shape *shape0 i32 winding = v2_winding(v2_sub(s.c.p, s.a.p), v2_sub(s.b.p, s.a.p)); u32 epa_iterations = 0; - while (1) { + for (;;) { ++epa_iterations; /* Find dir from origin to closest edge */ @@ -1001,7 +1001,7 @@ b32 collider_collision_boolean(struct collider_shape *shape0, struct collider_sh if (v2_dot(dir, p) >= 0) { s.b = s.a; s.a = p; - while (1) { + for (;;) { /* Third point is support point in direction of line normal towards origin */ dir = v2_perp_towards_dir(v2_sub(s.b, s.a), v2_neg(s.a)); p = get_menkowski_point(shape0, shape1, dir); diff --git a/src/draw.c b/src/draw.c index 8a239704..2f0a6484 100644 --- a/src/draw.c +++ b/src/draw.c @@ -84,7 +84,7 @@ void draw_circle(struct gp_flow *flow, struct v2 pos, f32 radius, u32 color, u32 struct arena_temp scratch = scratch_begin_no_conflict(); struct v2 *points = arena_push_array_no_zero(scratch.arena, struct v2, detail); - for(u32 i = 0; i < detail; ++i) { + for (u32 i = 0; i < detail; ++i) { f32 angle = ((f32)i / (f32)detail) * TAU; struct v2 p = V2( radius * math_cos(angle), diff --git a/src/gp_dx12.c b/src/gp_dx12.c index b83fcd57..aa349452 100644 --- a/src/gp_dx12.c +++ b/src/gp_dx12.c @@ -478,7 +478,7 @@ INTERNAL void dx12_init_device(void) struct string error = LIT("Could not initialize GPU device."); struct string first_gpu_name = ZI; u32 adapter_index = 0; - while (1) { + for (;;) { { hr = IDXGIFactory6_EnumAdapterByGpuPreference(G.factory, adapter_index, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, &IID_IDXGIAdapter1, (void **)&adapter); } diff --git a/src/mp3_mmf.c b/src/mp3_mmf.c index fa3c2327..b22aecbe 100644 --- a/src/mp3_mmf.c +++ b/src/mp3_mmf.c @@ -94,7 +94,7 @@ struct mp3_decode_result mp3_decode(struct arena *arena, struct string encoded, res.pcm.samples = arena_push_dry(arena, i16); u64 sample_bytes_read = 0; - while (1) { + for (;;) { IMFSample *sample; DWORD sample_flags = 0; HRESULT hr = IMFSourceReader_ReadSample(reader, (DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, 0, &sample_flags, 0, &sample); diff --git a/src/space.c b/src/space.c index ba0ff614..113a6883 100644 --- a/src/space.c +++ b/src/space.c @@ -401,7 +401,7 @@ struct space_entry *space_iter_next(struct space_iter *iter) return 0; } - while (1) { + for (;;) { if (next_node) { struct space_entry *entry = next_node->entry; struct aabb entry_aabb = entry->aabb; diff --git a/src/sprite.c b/src/sprite.c index ae8b49a9..483e7177 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -735,7 +735,7 @@ INTERNAL void refcount_add(struct cache_entry *e, i32 amount) i32 evictor_cycle = atomic32_fetch(&G.evictor_cycle.v); struct atomic64 *refcount_atomic = &e->refcount_struct.v; u64 old_refcount_uncast = atomic64_fetch(refcount_atomic); - while (1) { + for (;;) { struct cache_refcount new_refcount = *(struct cache_refcount *)&old_refcount_uncast; new_refcount.count += amount; new_refcount.last_ref_cycle = evictor_cycle; diff --git a/src/sys_win32.c b/src/sys_win32.c index 47058154..de2ab6d8 100644 --- a/src/sys_win32.c +++ b/src/sys_win32.c @@ -896,10 +896,9 @@ INTERNAL void job_fiber_entry(void *id_ptr) i16 id = (i32)(i64)id_ptr; struct fiber *fiber = fiber_from_id(id); __prof_fiber_enter(fiber->name_cstr, PROF_THREAD_GROUP_FIBERS + MEBI(fiber->job_pool) + fiber->id + 1); - while (1) { + for (;;) { /* Run job */ { - //__profn("Run job"); volatile struct yield_param *yield_param = fiber->yield_param; yield_param->kind = YIELD_KIND_NONE; struct sys_job_data data = ZI; @@ -911,6 +910,7 @@ INTERNAL void job_fiber_entry(void *id_ptr) MemoryBarrier(); } } + /* Yield */ { volatile struct yield_param *yield_param = fiber->yield_param; yield_param->kind = YIELD_KIND_DONE;