Commit Graph

3827 Commits

Author SHA1 Message Date
Jeroen van Rijn
18471f358e Merge pull request #1025 from Kelimion/png_info
Change PNG's img.sidecar to ^Info, make img.depth an int.
2021-06-20 18:40:46 +02:00
Jeroen van Rijn
55d09251d8 Change PNG's img.sidecar to ^Info, make img.depth an int.
For compatibility with the upcoming OpenEXR code, img.depth is now an int.
Like OpenEXR's code, it will now also return metadata as ^Info instead of Info.

The example was updated to retrieve the metadata this way.

It regrettably does not fix: #1018. That seems to be a codegen issue in the test runner or elsewhere.
2021-06-20 18:27:23 +02:00
Jeroen van Rijn
d66fd71d21 Merge pull request #1024 from Kelimion/defer_fix
GZIP defer diverging fix in gzip example.
2021-06-20 17:40:15 +02:00
Jeroen van Rijn
f10fc2a494 Merge pull request #1023 from Kelimion/test_runner_fix
Fix Windows test runner.
2021-06-20 17:37:04 +02:00
Jeroen van Rijn
055d8c5370 Fix Windows test runner. 2021-06-20 17:33:39 +02:00
Jeroen van Rijn
955472bd21 GZIP defer diverging fix in gzip example. 2021-06-20 17:21:18 +02:00
gingerBill
a2d5f660ed Merge pull request #1022 from Kelimion/buffer_convert
Add `bytes.buffer_create_of_type` and `bytes.buffer_convert_to_type`.
2021-06-18 16:41:48 +01:00
Jeroen van Rijn
8a4b9ddaa3 Fix comment. 2021-06-18 15:42:04 +02:00
Jeroen van Rijn
54a2b6f00e Add bytes.buffer_create_of_type and bytes.buffer_convert_to_type.
Convenience functions to reinterpret or cast one buffer to another type, or create a buffer of a specific type.

	Example:
```odin
	fmt.println("Convert []f16le (x2) to []f32 (x2).");
	b := []u8{0, 60, 0, 60}; // == []f16{1.0, 1.0}

	res, backing, had_to_allocate, err := bytes.buffer_convert_to_type(2, f32, f16le, b);
	fmt.printf("res      : %v\n", res);              // [1.000, 1.000]
	fmt.printf("backing  : %v\n", backing);          // &Buffer{buf = [0, 0, 128, 63, 0, 0, 128, 63], off = 0, last_read = Invalid}
	fmt.printf("allocated: %v\n", had_to_allocate);  // true
	fmt.printf("err      : %v\n", err);              // false

	if had_to_allocate { defer bytes.buffer_destroy(backing); }

	fmt.println("\nConvert []f16le (x2) to []u16 (x2).");

	res2: []u16;
	res2, backing, had_to_allocate, err = bytes.buffer_convert_to_type(2, u16, f16le, b);
	fmt.printf("res      : %v\n", res2);             // [15360, 15360]
	fmt.printf("backing  : %v\n", backing);          // Buffer.buf points to `b` because it could be converted in-place.
	fmt.printf("allocated: %v\n", had_to_allocate);  // false
	fmt.printf("err      : %v\n", err);              // false

	if had_to_allocate { defer bytes.buffer_destroy(backing); }

	fmt.println("\nConvert []f16le (x2) to []u16 (x2), force_convert=true.");

	res2, backing, had_to_allocate, err = bytes.buffer_convert_to_type(2, u16, f16le, b, true);
	fmt.printf("res      : %v\n", res2);             // [1, 1]
	fmt.printf("backing  : %v\n", backing);          // Buffer.buf points to `b` because it could be converted in-place.
	fmt.printf("allocated: %v\n", had_to_allocate);  // false
	fmt.printf("err      : %v\n", err);              // false

	if had_to_allocate { defer bytes.buffer_destroy(backing); }
```
2021-06-18 15:25:36 +02:00
gingerBill
abe728dbbb Add intrinsics.type_is_endian_platform 2021-06-17 20:39:00 +01:00
gingerBill
574ceb37a9 Correct selector call expression chaining behaviour (a bit of a hack) 2021-06-16 17:04:05 +01:00
gingerBill
dbdc4471c2 Fix double evaluation bug with selector call expressions x->y(z) 2021-06-16 14:03:12 +01:00
gingerBill
af95381bf8 Add missing -> ! annotation 2021-06-16 12:12:24 +01:00
gingerBill
41f2539484 Improve logic for diverging procedures by checking if it terminates 2021-06-16 12:07:24 +01:00
gingerBill
8f57bb0799 Add unreachable detection for deferred statements in a scope which contains a diverging procedure call
```odin
{
    defer foo(); // Unreachable defer statement due to diverging procedure call at the end of the current scope
    os.exit(0);
}
```
2021-06-16 11:41:29 +01:00
gingerBill
84a4188c72 Fix #1017 2021-06-15 01:16:19 +01:00
gingerBill
31f1e0aeae Fix #1019 2021-06-15 01:13:16 +01:00
gingerBill
4b8cbb5a3b Fix #1015 2021-06-14 13:26:28 +01:00
gingerBill
3e7aabe6d8 Change uses for parapoly records to use $ always 2021-06-14 11:43:35 +01:00
gingerBill
d4df325e0a Just create context when required 2021-06-14 11:41:50 +01:00
gingerBill
9f8a63cb43 More minor stylization changes (remove unneeded parentheses) 2021-06-14 11:34:31 +01:00
gingerBill
6f745677b4 Minor formatting changes 2021-06-14 11:30:00 +01:00
gingerBill
86649e6b44 Core library clean up: Make range expressions more consistent and replace uses of .. with ..= 2021-06-14 11:15:25 +01:00
gingerBill
3ca887a60a Add struct_fields_zipped and enum_fields_zipped (allowing for iteration through an #soa slice) 2021-06-14 11:04:51 +01:00
gingerBill
312a1e8a94 Fix context logic 2021-06-13 16:00:20 +01:00
gingerBill
9a311ab9e7 Remove dead code 2021-06-12 16:47:20 +01:00
gingerBill
7d92eaaeb2 Correct context logic in lb_build_addr 2021-06-12 16:45:44 +01:00
gingerBill
582f423b67 Improve vector arithmetic generation for array programming operations 2021-06-12 16:37:20 +01:00
gingerBill
c2524464f9 Fix remove_temp_files 2021-06-12 16:23:41 +01:00
gingerBill
55e472cdb6 Fix linkage problem for procedures required by LLVM 2021-06-10 12:23:08 +01:00
gingerBill
e6ad773a88 Minor code clean up 2021-06-09 23:47:44 +01:00
gingerBill
82eae32bca Improve code generation for type switch statements to use a jump table by default 2021-06-09 23:46:00 +01:00
gingerBill
b0e21bd616 Allow trivial optimizations for switch statements of typeid 2021-06-09 23:05:37 +01:00
gingerBill
7b88bed098 Do trivial SwitchInstr optimization for constant case switch statements 2021-06-09 22:55:08 +01:00
gingerBill
28abf5d33b Correct minimum dependency for complex32 2021-06-08 21:20:33 +01:00
gingerBill
fb8ad338d0 Keep -vet happy 2021-06-08 18:26:38 +01:00
gingerBill
ee60be0137 Improve code generation hints for return statements which return by pointer 2021-06-08 17:17:53 +01:00
gingerBill
9efd4c5097 Aid code generation on non-release builds 2021-06-08 17:17:24 +01:00
gingerBill
f30e6f50bd Reorganize code to improve code generation 2021-06-08 16:21:19 +01:00
gingerBill
8ec2ca9dcd Remove context.thread_id 2021-06-08 15:57:00 +01:00
gingerBill
f19bb0f4d4 Make default calling convention code more correct to read 2021-06-08 14:33:49 +01:00
gingerBill
76bb82a726 Minor alignment cleanup for swizzle load 2021-06-08 14:27:36 +01:00
gingerBill
8e62f9c83c Correct is_operand_value for Swizzle addressing modes 2021-06-08 14:23:44 +01:00
gingerBill
696f758435 Fix and improve swizzle loads for ordered indices 2021-06-08 14:19:27 +01:00
gingerBill
6421152104 Fix show-timings header for -lld on windows 2021-06-08 13:19:19 +01:00
gingerBill
1e989f5c10 Fix -lld on Windows 2021-06-08 13:10:22 +01:00
gingerBill
3eb42ecb55 Minor improvements to -use-separate-modules 2021-06-08 13:00:20 +01:00
gingerBill
286cb60c45 Minor changes to tools/odinfmt 2021-06-08 12:18:55 +01:00
gingerBill
28e9a4f79c Replace js_wasm32 with freestanding_wasm32 2021-06-08 12:18:26 +01:00
gingerBill
e79fb68291 Correct #soa type creation 2021-06-08 11:23:23 +01:00