diff --git a/core/math/linalg/specific.odin b/core/math/linalg/specific.odin index 4eca42000..7aee992d0 100644 --- a/core/math/linalg/specific.odin +++ b/core/math/linalg/specific.odin @@ -119,8 +119,10 @@ vector4_linear_to_srgb :: proc(col: Vector4) -> Vector4 { } vector4_hsl_to_rgb :: proc(h, s, l: Float, a: Float = 1) -> Vector4 { - hue_to_rgb :: proc(p, q, t0: Float) -> Float { - t := math.mod(t0, 1.0); + hue_to_rgb :: proc(p, q, t: Float) -> Float { + t := t; + if t < 0 do t += 1; + if t > 1 do t -= 1; switch { case t < 1.0/6.0: return p + (q - p) * 6.0 * t; case t < 1.0/2.0: return q; diff --git a/core/os/os.odin b/core/os/os.odin index 10613e513..bd76fae2f 100644 --- a/core/os/os.odin +++ b/core/os/os.odin @@ -70,7 +70,7 @@ file_size_from_path :: proc(path: string) -> i64 { return length; } -read_entire_file :: proc(name: string) -> (data: []byte, success: bool) { +read_entire_file :: proc(name: string, allocator := context.allocator) -> (data: []byte, success: bool) { fd, err := open(name, O_RDONLY, 0); if err != 0 { return nil, false; @@ -86,7 +86,7 @@ read_entire_file :: proc(name: string) -> (data: []byte, success: bool) { return nil, true; } - data = make([]byte, int(length)); + data = make([]byte, int(length), allocator); if data == nil { return nil, false; } diff --git a/core/os/os_windows.odin b/core/os/os_windows.odin index 72916b1e4..3aedb4e59 100644 --- a/core/os/os_windows.odin +++ b/core/os/os_windows.odin @@ -271,7 +271,7 @@ get_page_size :: proc() -> int { // The current directory is stored as a global variable in the process. @private cwd_gate := false; -get_current_directory :: proc() -> string { +get_current_directory :: proc(allocator := context.allocator) -> string { for intrinsics.atomic_xchg(&cwd_gate, true) {} sz_utf16 := win32.GetCurrentDirectoryW(0, nil); @@ -282,7 +282,7 @@ get_current_directory :: proc() -> string { intrinsics.atomic_store(&cwd_gate, false); - return win32.utf16_to_utf8(dir_buf_wstr); + return win32.utf16_to_utf8(dir_buf_wstr, allocator); } set_current_directory :: proc(path: string) -> (err: Errno) { diff --git a/core/path/path.odin b/core/path/path.odin index b2fe1c7df..3826e8032 100644 --- a/core/path/path.odin +++ b/core/path/path.odin @@ -48,8 +48,8 @@ base :: proc(path: string, new := false, allocator := context.allocator) -> stri name :: proc(path: string, new := false, allocator := context.allocator) -> string { if path == "" do return ""; - dot := len(path); - end := dot - 1; + end := len(path) - 1; + dot := end; for i := end; i >= 0; i -= 1 { switch path[i] {