Commit Graph

3861 Commits

Author SHA1 Message Date
gingerBill
74dee82dbf Fix compiler errors 2021-06-25 14:33:42 +01:00
gingerBill
f1cf724bd4 Add bufio.Scanner 2021-06-25 14:31:35 +01:00
gingerBill
fc809d3fad Merge branch 'master' of https://github.com/odin-lang/Odin 2021-06-24 19:41:36 +01:00
gingerBill
42d135aade Change logic for comparison against nil for array-like data types (compare the pointer rather than the length/capacity) 2021-06-24 19:39:51 +01:00
Jeroen van Rijn
ab12ca69af Merge pull request #1040 from Kelimion/zlib_optimize
Adler32 speedup.
2021-06-24 19:15:22 +02:00
Jeroen van Rijn
17748f18b9 Adler32 speedup. 2021-06-24 19:06:39 +02:00
gingerBill
3803bdff5f Allow bufio.Reader and bufio.Writer to have a configurable max_consecutive_empty_(reads|writes) field 2021-06-24 15:56:58 +01:00
gingerBill
0a94a67190 Merge branch 'master' of https://github.com/odin-lang/Odin 2021-06-24 15:55:50 +01:00
gingerBill
8dcb14fbc2 Add helper procedures for strings.Reader creation 2021-06-24 15:55:42 +01:00
Jeroen van Rijn
f62f40e508 Merge pull request #1039 from Kelimion/zlib_optimize
ZLIB: Another 10%+ faster.
2021-06-24 15:02:02 +02:00
Jeroen van Rijn
980aa37bee ZLIB: Another 10%+ faster. 2021-06-24 14:56:28 +02:00
gingerBill
1e9cc058a0 Update hash.crc32 to use slicing-by-8 algorithm to improve throughput by ~3.5x 2021-06-24 00:03:59 +01:00
Jeroen van Rijn
824efc82b9 Merge pull request #1036 from Kelimion/zlib_optimize
ZLIB: More faster.
2021-06-23 22:25:02 +02:00
Jeroen van Rijn
1cfe226686 ZLIB: More faster. 2021-06-23 22:18:17 +02:00
Jeroen van Rijn
ea0ce7bd2c Merge pull request #1035 from Kelimion/zlib_optimize
Zlib optimize
2021-06-23 20:15:32 +02:00
Jeroen van Rijn
342adb627d All reads now skip stream if in memory. 2021-06-23 16:32:48 +02:00
Jeroen van Rijn
a70635d2f6 Most reads now go through buffer for zlib. 2021-06-23 16:32:48 +02:00
Jeroen van Rijn
5cb16c4cd1 All reads now go through read_slice. 2021-06-23 16:32:48 +02:00
Jeroen van Rijn
538004ba5f Introduce read_slice, make read_u8 use it. 2021-06-23 16:32:48 +02:00
Jeroen van Rijn
8663c64e47 Refactor ZLIB structs. 2021-06-23 16:32:47 +02:00
gingerBill
bb3ffdbdfb Merge branch 'master' of https://github.com/odin-lang/Odin 2021-06-23 14:55:53 +01:00
gingerBill
fcf7cf973b Add documentation for -verbose-errors 2021-06-23 14:55:40 +01:00
Jeroen van Rijn
fb2e1c32bd Merge pull request #1034 from Kelimion/bytes_util
Move `bytes` utils back to EXR code for the time being.
2021-06-22 16:48:07 +02:00
Jeroen van Rijn
ae0b8fce44 Move bytes utils back to EXR code for the time being.
Also, allow PNG example to be run directly from `core:image/png` directory.
2021-06-22 16:39:00 +02:00
Jeroen van Rijn
d2e55f9ffa Merge pull request #1032 from Kelimion/png_fix
PNG: Fix leak if you don't ask for metadata.
2021-06-21 22:56:39 +02:00
Jeroen van Rijn
d5e2b387fa PNG: Fix leak if you don't ask for metadata. 2021-06-21 22:47:54 +02:00
Jeroen van Rijn
922b511a24 Merge pull request #1031 from Kelimion/zlib_fix
ZLIB: fix.
2021-06-21 22:16:56 +02:00
Jeroen van Rijn
9de9111082 ZLIB: fix. 2021-06-21 22:15:04 +02:00
Jeroen van Rijn
5a7fe2e3d9 Merge pull request #1030 from Kelimion/zlib_optimize
Comment out tracy imports.
2021-06-21 21:43:57 +02:00
Jeroen van Rijn
1e8c12c2a3 Comment out tracy imports. 2021-06-21 21:41:56 +02:00
Jeroen van Rijn
b92c70e55c Merge pull request #1029 from Kelimion/zlib_optimize
ZLIB: Start optimization.
2021-06-21 21:26:52 +02:00
Jeroen van Rijn
352494cbb4 ZLIB: Start optimization. 2021-06-21 21:05:52 +02:00
Jeroen van Rijn
797c41950a Merge pull request #1027 from Kelimion/png
Replace `core:image`'s `sidecar` with explicit pointer and type
2021-06-21 16:41:38 +02:00
Jeroen van Rijn
e036a321a0 Replace core:image's sidecar with explicit metadata_ptr and metadata_type.
To unpack, use:
```odin

v: ^png.Info;

if img.metadata_ptr != nil && img.metadata_type == png.Info {
	v = (^png.Info)(img.metadata_ptr);
	...
}
```
2021-06-21 16:32:42 +02:00
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