|
@@ -3,6 +3,12 @@ package mem
|
|
|
import "core:runtime"
|
|
|
import "core:intrinsics"
|
|
|
|
|
|
+Byte :: 1
|
|
|
+Kilobyte :: 1024 * Byte
|
|
|
+Megabyte :: 1024 * Kilobyte
|
|
|
+Gigabyte :: 1024 * Megabyte
|
|
|
+Terabyte :: 1024 * Gigabyte
|
|
|
+
|
|
|
set :: proc "contextless" (data: rawptr, value: byte, len: int) -> rawptr {
|
|
|
return runtime.memset(data, i32(value), len)
|
|
|
}
|
|
@@ -192,11 +198,6 @@ any_to_bytes :: proc "contextless" (val: any) -> []byte {
|
|
|
}
|
|
|
|
|
|
|
|
|
-kilobytes :: proc "contextless" (x: int) -> int { return (x) * 1024 }
|
|
|
-megabytes :: proc "contextless" (x: int) -> int { return kilobytes(x) * 1024 }
|
|
|
-gigabytes :: proc "contextless" (x: int) -> int { return megabytes(x) * 1024 }
|
|
|
-terabytes :: proc "contextless" (x: int) -> int { return gigabytes(x) * 1024 }
|
|
|
-
|
|
|
is_power_of_two :: proc "contextless" (x: uintptr) -> bool {
|
|
|
if x <= 0 {
|
|
|
return false
|