From: Brendan Hansen Date: Wed, 30 Dec 2020 19:18:59 +0000 (-0600) Subject: getting rid of those fricken tabs X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=da8e88a2def61d234d7a695a040904a5ae938c9a;p=onyx.git getting rid of those fricken tabs --- diff --git a/core/alloc/fixed.onyx b/core/alloc/fixed.onyx index 9a46ea11..a9879c26 100644 --- a/core/alloc/fixed.onyx +++ b/core/alloc/fixed.onyx @@ -11,30 +11,30 @@ package core.alloc.fixed // but can get the speed increase of a simple allocation strategy. FixedAllocatorData :: struct { - ptr : rawptr; - size : u32; + ptr : rawptr; + size : u32; } #private_file fixed_allocator_proc :: proc (data: rawptr, aa: AllocationAction, size: u32, align: u32, oldptr: rawptr) -> rawptr { - fa_data := cast(^FixedAllocatorData) data; + fa_data := cast(^FixedAllocatorData) data; - if aa != AllocationAction.Alloc do return null; - if size > fa_data.size do return null; - - return fa_data.ptr; + if aa != AllocationAction.Alloc do return null; + if size > fa_data.size do return null; + + return fa_data.ptr; } make :: proc (ptr: rawptr, size: u32) -> FixedAllocatorData { - return FixedAllocatorData.{ - ptr = ptr, - size = size, - }; + return FixedAllocatorData.{ + ptr = ptr, + size = size, + }; } make_allocator :: proc (fa_data: ^FixedAllocatorData) -> Allocator { - return Allocator.{ - func = fixed_allocator_proc, - data = fa_data, - }; + return Allocator.{ + func = fixed_allocator_proc, + data = fa_data, + }; } diff --git a/core/alloc/ring.onyx b/core/alloc/ring.onyx index d93fd9be..474f5eb6 100644 --- a/core/alloc/ring.onyx +++ b/core/alloc/ring.onyx @@ -39,17 +39,17 @@ ring_alloc_proc :: proc (data: rawptr, aa: AllocationAction, size: u32, align: u } make :: proc (buffer: rawptr, length: u32) -> RingState { - return RingState.{ - base_ptr = buffer, - curr_ptr = buffer, - size = length, - }; + return RingState.{ + base_ptr = buffer, + curr_ptr = buffer, + size = length, + }; } make_allocator :: proc (rs: ^RingState) -> Allocator { - return Allocator.{ - func = ring_alloc_proc, - data = rs, - }; + return Allocator.{ + func = ring_alloc_proc, + data = rs, + }; } diff --git a/core/map.onyx b/core/map.onyx index 96a240a0..a6e6b76e 100644 --- a/core/map.onyx +++ b/core/map.onyx @@ -92,23 +92,23 @@ empty :: proc (use map: ^Map($K, $V)) -> bool { } hash_function :: proc { - proc (key: rawptr) -> u32 { return 0xcbf29ce7 ^ cast(u32) key; }, - proc (key: i32) -> u32 { return 0xcbf29ce7 ^ cast(u32) key; }, - proc (key: i64) -> u32 { return cast(u32) (cast(u64) 0xcbf29ce7 ^ cast(u64) key); }, - - proc (key: str) -> u32 { - hash: u32 = 5381; - for ch: key do hash += (hash << 5) + ~~ch; - return hash; - }, + proc (key: rawptr) -> u32 { return 0xcbf29ce7 ^ cast(u32) key; }, + proc (key: i32) -> u32 { return 0xcbf29ce7 ^ cast(u32) key; }, + proc (key: i64) -> u32 { return cast(u32) (cast(u64) 0xcbf29ce7 ^ cast(u64) key); }, + + proc (key: str) -> u32 { + hash: u32 = 5381; + for ch: key do hash += (hash << 5) + ~~ch; + return hash; + }, } cmp_function :: proc { - proc (a: rawptr, b: rawptr) -> bool { return a == b; }, - proc (a: i32, b: i32) -> bool { return a == b; }, - proc (a: i64, b: i64) -> bool { return a == b; }, + proc (a: rawptr, b: rawptr) -> bool { return a == b; }, + proc (a: i32, b: i32) -> bool { return a == b; }, + proc (a: i64, b: i64) -> bool { return a == b; }, - string.equal, + string.equal, } // diff --git a/core/math.onyx b/core/math.onyx index f2999bc3..235cec4b 100644 --- a/core/math.onyx +++ b/core/math.onyx @@ -10,47 +10,47 @@ TAU :: 6.28318330f; // Simple taylor series approximation of sin(t) sin :: proc (t_: f32) -> f32 { - t := t_; - while t >= PI do t -= TAU; - while t <= -PI do t += TAU; + t := t_; + while t >= PI do t -= TAU; + while t <= -PI do t += TAU; - res := 0.0f; + res := 0.0f; - plus_minus := 1.0f; - n := 13; - while n > 1 { - res += plus_minus; - res *= t * t / cast(f32) (n * n - n); + plus_minus := 1.0f; + n := 13; + while n > 1 { + res += plus_minus; + res *= t * t / cast(f32) (n * n - n); - plus_minus = -plus_minus; - n -= 2; - } + plus_minus = -plus_minus; + n -= 2; + } - res += 1.0f; - res *= t; - return res; + res += 1.0f; + res *= t; + return res; } // Simple taylor series approximation of cos(t) cos :: proc (t_: f32) -> f32 { - t := t_; - while t >= PI do t -= TAU; - while t <= -PI do t += TAU; + t := t_; + while t >= PI do t -= TAU; + while t <= -PI do t += TAU; - res := 0.0f; + res := 0.0f; - plus_minus := 1.0f; - n := 12; - while n > 1 { - res += plus_minus; - res *= t * t / cast(f32) (n * n - n); + plus_minus := 1.0f; + n := 12; + while n > 1 { + res += plus_minus; + res *= t * t / cast(f32) (n * n - n); - plus_minus = -plus_minus; - n -= 2; - } + plus_minus = -plus_minus; + n -= 2; + } - res += 1.0f; - return res; + res += 1.0f; + return res; } max :: proc (a: $T, b: T) -> T { diff --git a/core/memory.onyx b/core/memory.onyx index ffd0fbf3..da952cbe 100644 --- a/core/memory.onyx +++ b/core/memory.onyx @@ -1,9 +1,9 @@ package core.memory copy :: proc (dst_: rawptr, src_: rawptr, len: u32) { - dst := cast(^u8) dst_; - src := cast(^u8) src_; - for i: 0 .. len do dst[i] = src[i]; + dst := cast(^u8) dst_; + src := cast(^u8) src_; + for i: 0 .. len do dst[i] = src[i]; } set :: proc (start: rawptr, length: u32, value: u8) { diff --git a/core/random.onyx b/core/random.onyx index 4ad3b58f..41a17c51 100644 --- a/core/random.onyx +++ b/core/random.onyx @@ -10,7 +10,7 @@ set_seed :: proc (s: u32) do seed = s; int :: proc (s := ^seed) -> u32 { *s = *s * RANDOM_MULTIPLIER + RANDOM_INCREMENT; - return *s; + return *s; } between :: proc (lo: i32, hi: i32) -> i32 do return int () % (hi + 1 - lo) + lo; diff --git a/progs/poly_solidify.onyx b/progs/poly_solidify.onyx index e197154a..ae59bc0c 100644 --- a/progs/poly_solidify.onyx +++ b/progs/poly_solidify.onyx @@ -11,15 +11,15 @@ specific_compose_1 :: #solidify specific_compose_0 { A = f32 }; specific_compose_2 :: #solidify specific_compose_1 { C = f64 }; main :: proc (args: [] cstr) { - printf("max(1, 2) = %i\n", math.max(1, 2)); - printf("max_f32(1.0, 2.0) = %f\n", max_f32(1, 2)); + printf("max(1, 2) = %i\n", math.max(1, 2)); + printf("max_f32(1.0, 2.0) = %f\n", max_f32(1, 2)); - // printf("max_f32(1, 2) = %i\n", max_f32(cast(u32) 1, cast(u32) 2)); + // printf("max_f32(1, 2) = %i\n", max_f32(cast(u32) 1, cast(u32) 2)); - println(specific_compose_2( - 2, - proc (a: f32) -> f32 { return ~~(a * 2); }, - proc (b: f32) -> f64 { return ~~(b + 6); })); + println(specific_compose_2( + 2, + proc (a: f32) -> f32 { return ~~(a * 2); }, + proc (b: f32) -> f64 { return ~~(b + 6); })); arr1 : [..] f32; diff --git a/tests/hello_world.onyx b/tests/hello_world.onyx index 1a7a528a..7d031f3f 100644 --- a/tests/hello_world.onyx +++ b/tests/hello_world.onyx @@ -5,5 +5,5 @@ package main use package core main :: proc (args: [] cstr) { - println("Hello, World!"); + println("Hello, World!"); }