Commit Graph

5282 Commits

Author SHA1 Message Date
Feoramund
c8a62ee4ec Make simd_util index procs contextless where applicable 2024-08-09 18:54:04 -04:00
Feoramund
12dd0cb72a Simplify and make simd_util cross-platform
This new algorithm uses a Scalar->Vector->Scalar iteration loop which
requires no masking off of any incomplete data chunks.

Also, the width was reduced to 32 bytes instead of 64, as I found this
to be about as fast as the previous 64-byte x86 version.
2024-08-09 18:54:04 -04:00
Feoramund
f66fcd9acb Use vectorized index_* procs in core 2024-08-06 15:19:05 -04:00
Feoramund
8deeb40e5d Add vectorized index_byte and last_index_byte 2024-08-06 15:19:01 -04:00
Laytan
4423aac3de Merge pull request #4031 from RilleP/bit-field-closing-brace-fix
Fix missing closing brace for Bit_Field in core:odin/parser
2024-08-06 20:49:49 +02:00
gingerBill
94ded29b5f Merge pull request #4030 from Kelimion/struct_field_count
Add `reflect.struct_field_count` that returns the number of fields in a struct type
2024-08-06 18:56:24 +01:00
Rikard Petré
6a6f078186 Fix missing closing brace for Bit_Field in core:odin/parser 2024-08-06 19:48:38 +02:00
Jeroen van Rijn
17ebaffce8 Update comment. 2024-08-05 22:12:22 +02:00
Jeroen van Rijn
4902288a5a Add reflect.struct_field_count that returns the number of fields in a struct type
Example:
```odin
package struct_count_example

import "core:fmt"
import "core:reflect"
import "core:dynlib"

Foo :: struct{
	one: int,
	two: f32,
}

Bar :: struct {
	three: int,
	four:  bool,
	five:  f64,
}

Game_Api :: struct {
	init:      proc(api: ^Game_Api),
	update:    proc(api: ^Game_Api),

	using foo: Foo,
	bar:       Bar,

	// Private stuff
	reload_count: int,
	__handle:     rawptr,
}
API_PRIVATE_COUNT :: 2

game_api: Game_Api

main :: proc() {
	fmt.printfln("Game_Api, .Top:       %v", reflect.struct_field_count(Game_Api))              // 6
	fmt.printfln("Game_Api, .Using:     %v", reflect.struct_field_count(Game_Api, .Using))      // 8
	fmt.printfln("Game_Api, .Recursive: %v", reflect.struct_field_count(Game_Api, .Recursive))  // 11

	symbols_loaded, _  := dynlib.initialize_symbols(&game_api, "game.dll")
	symbols_expected   := reflect.struct_field_count(Game_Api) - API_PRIVATE_COUNT

	if symbols_loaded == -1 {
		fmt.eprintln("Couldn't load game.dll")
		return
	} else if symbols_loaded != symbols_expected {
		fmt.eprintfln("Expected %v symbols, got %v", symbols_expected, symbols_loaded)
		return
	}
}
```
2024-08-05 22:04:16 +02:00
Feoramund
4c0ab09c9a Handle EPIPE in Darwin core:net 2024-08-05 13:15:08 -04:00
Feoramund
3512d7c672 Move Darwin MSG_NOSIGNAL to core:os 2024-08-05 12:49:12 -04:00
Feoramund
eba0774bf3 Prevent SIGPIPE on Darwin when writing to a closed core:net socket
Mimics behavior found on Linux implementation.
2024-08-05 12:23:09 -04:00
Karl Zylinski
b63657d293 Fix for blend_pixel.odin in core/image/common.odin not compiling 2024-08-05 17:23:58 +02:00
Karl Zylinski
2d32b819dc common.odin compile fix
Fix for "Error: Prefer to separate 'where' clauses with a comma rather than '&&'"
2024-08-05 16:32:34 +02:00
gingerBill
f56abf3780 Add intrinsics.masked_expand_load and intrinsics.masked_compress_store 2024-08-05 14:54:09 +01:00
gingerBill
78919f8524 Fix typos 2024-08-05 14:48:55 +01:00
gingerBill
84ac56f778 Add intrinsics.simd_masked_load and intrinsics.simd_masked_store 2024-08-05 14:08:41 +01:00
gingerBill
7e701d1677 Add intrinsics.simd_gather and `intrinsics.simd_scatter 2024-08-05 13:46:24 +01:00
gingerBill
b67ed78afd add_sat -> saturating_add 2024-08-05 13:21:27 +01:00
gingerBill
90fc52c2ee Rename add_sat -> saturating_add 2024-08-05 13:19:01 +01:00
gingerBill
9a01a13914 Add simd_reduce_any and simd_reduce_all 2024-08-05 13:13:19 +01:00
gingerBill
60bc7f53d2 Comment out open_buffered 2024-08-04 17:41:48 +01:00
gingerBill
cf3c1a85ec Remove temp parameter 2024-08-04 17:36:28 +01:00
gingerBill
046f72befd Mock out open_buffered 2024-08-04 17:31:39 +01:00
gingerBill
f19436fb4d Only swap if there was an arena 2024-08-04 17:17:09 +01:00
gingerBill
d0709a7de2 Allow for nested temp_allocator() calls to flip between arenas on TEMP_ALLOCATOR_GUARDs 2024-08-04 17:14:24 +01:00
gingerBill
c078b2dd1b Add @(require_results) 2024-08-04 15:24:26 +01:00
gingerBill
bf948ab8ae Add stubs for flush on platforms that didn't have it 2024-08-04 15:07:24 +01:00
gingerBill
acb1ebddf6 Fix err != 0 uses 2024-08-04 15:01:04 +01:00
gingerBill
93fabf8628 Replace err != 0 with err != nil where possible 2024-08-04 14:57:25 +01:00
gingerBill
fc10b781af Update core/os/os2/process.odin
Co-authored-by: Laytan <laytanlaats@hotmail.com>
2024-08-04 14:47:44 +01:00
gingerBill
6a6b5061db Update core/os/os_darwin.odin
Co-authored-by: Laytan <laytanlaats@hotmail.com>
2024-08-04 14:47:35 +01:00
gingerBill
b67817517e Fix replace typo 2024-08-04 14:46:32 +01:00
gingerBill
fff1d509d5 Add read_entire_file_or_err and write_entire_file_or_err 2024-08-04 14:41:55 +01:00
gingerBill
e8d26c5797 Move errors to where appropriate 2024-08-04 13:41:34 +01:00
gingerBill
3d992e2704 Improve _error_string for Linux 2024-08-04 13:25:35 +01:00
gingerBill
0c5b645dde Correct EOF value 2024-08-04 13:20:33 +01:00
gingerBill
cf5ec25873 Add extra cases for flush 2024-08-04 13:18:51 +01:00
gingerBill
7663a2036a Add read_at/write_at to missing platforms 2024-08-04 13:16:37 +01:00
gingerBill
c32f345c68 Move error stuff to errors.odin 2024-08-04 12:55:08 +01:00
gingerBill
bdbbbf5c95 Fix typo; remove unneeded casts 2024-08-04 12:39:21 +01:00
gingerBill
e8b6d15db9 Fix replace typo 2024-08-04 12:31:22 +01:00
gingerBill
5f7fef92fa Update example to use err != nil instead 2024-08-04 12:25:50 +01:00
gingerBill
66b86bc7e0 Correct os errors for darwin 2024-08-04 12:23:18 +01:00
gingerBill
97c499dbb4 Begin mapping os.Error in the rest of the codebase 2024-08-04 11:58:04 +01:00
gingerBill
1d75a612d5 os.Errno -> os.Error 2024-08-04 11:47:23 +01:00
gingerBill
160048eaee Errno -> Error 2024-08-04 11:46:42 +01:00
gingerBill
def2e2e271 Try to map to General_Error where possible 2024-08-04 11:44:45 +01:00
gingerBill
28666414bc More clean ups of ERROR_NONE and != nil usage 2024-08-04 11:37:49 +01:00
gingerBill
a241168142 Clean up err != nil usage 2024-08-04 11:26:35 +01:00