Commit Graph

3078 Commits (fd75e73ee9818f12fd81d8fdb3cb949c492d664a)

Author SHA1 Message Date
Ben Noordhuis fd75e73ee9 add f16 type
Add support for half-precision floating point operations.

Introduce `__extendhfsf2` and `__truncsfhf2` in std/special/compiler_rt.

Add `__gnu_h2f_ieee` and `__gnu_f2h_ieee` as aliases that are used in
Windows builds.

The logic in std/special/compiler_rt/extendXfYf2.zig has been reworked
and can now operate on 16 bits floating point types.

`extendXfYf2()` and `truncXfYf2()` are marked `inline` to work around
a not entirely understood stack alignment issue on Windows when calling
the f16 versions of the builtins.

closes #1122
2018-06-27 16:20:04 +02:00
Ben Noordhuis 1f45075a0e dry floating-point type definitions 2018-06-27 16:20:04 +02:00
Ben Noordhuis 0ebc7b66e6 scope variables in floating point cast tests
Fixes a bug where the result of a @floatCast wasn't actually checked; it
was checking the result from the previous @floatCast.
2018-06-27 16:20:04 +02:00
Andrew Kelley 4de60dde6e langref: explicit cast section 2018-06-26 15:48:42 -04:00
Andrew Kelley 11ca38a4e9 fix crash for optional pointer to empty struct
closes #1153
2018-06-26 15:27:41 -04:00
Andrew Kelley af95e15572 rename get_maybe_type to get_optional_type 2018-06-26 15:11:05 -04:00
Isaac Hier 8e714289ca Fix os_path_join for case where dirname is empty 2018-06-26 13:31:32 -04:00
Andrew Kelley 3290e72833 std.zig.ast: fix incorrect impl of FnProto.firstToken
closes #1151
2018-06-25 11:54:10 -04:00
Andrew Kelley 8866bef92c clean up self hosted main. delete unsupported commands 2018-06-22 01:54:38 -04:00
Andrew Kelley be2a4c42bd
Merge pull request #1149 from ziglang/issue346
fix compiler crash for invalid enum
2018-06-21 21:21:05 -04:00
Andrew Kelley 459d72f873 fix compiler crash for invalid enum
closes #1079
closes #1147
2018-06-21 17:41:49 -04:00
Andrew Kelley 5f38d6e2e9 add casting docs, __extenddftf2, and __extendsftf2 2018-06-21 14:44:35 -04:00
Andrew Kelley 47dd1049c8
Merge pull request #1145 from isaachier/bigint-neg-one-incr-fix
Fix bigint -1 increment operation
2018-06-21 13:40:37 -04:00
Isaac Hier f1207a8e74 Add test case 2018-06-21 08:32:05 -04:00
Isaac Hier eeda1a1396 Fix logic 2018-06-21 08:17:08 -04:00
Isaac Hier 0ab4afbf42 Fix increment operation for bigint -1 2018-06-21 08:14:26 -04:00
Marc Tiehuis f50c0c664f Add float repr bit extraction functions 2018-06-21 01:45:12 -04:00
Ben Noordhuis eb6a8e6a3b fix f128 remainder division bug
The modulo operation computed rem(b+rem(a,b), b) which produces -1
for a=1 and b=2.

Switch to a - b * trunc(a/b) which produces the expected result, 1.

closes #1137
2018-06-20 17:37:38 -04:00
Andrew Kelley 4eca75c53b Merge branch 'kristate-stdmem-replace-create-with-construct' 2018-06-20 17:33:49 -04:00
Andrew Kelley 85f928f8bf remove std.mem.Allocator.construct and other fixups 2018-06-20 17:33:29 -04:00
Andrew Kelley e891f9cd9d zig fmt 2018-06-20 17:16:27 -04:00
kristopher tate 6bd8610063 std.mem.Allocator.construct: improve formatting; 2018-06-21 01:40:25 +09:00
kristopher tate 4b46af4810 std.mem.Allocator.construct: remove deprecation warning; 2018-06-21 01:39:48 +09:00
kristopher tate 71db8df548 std: update stdlib to match updated allocator create signature; ref #733 2018-06-21 00:40:21 +09:00
kristopher tate 457c0f0a7e std.mem: remove allocator create in favor of construct; ref #733 2018-06-21 00:39:19 +09:00
Andrew Kelley 55193cb13b fix runtime fn ptr equality codegen
closes #1140
2018-06-20 06:46:53 -04:00
Andrew Kelley 7c99c30bf4 fix calling method with comptime pass-by-non-copyign-value self arg
closes #1124
2018-06-19 19:35:59 -04:00
Andrew Kelley 42db807f37 remove redundant implicit casting code
and introduce better type mismatch errors

closes #1061
2018-06-19 18:51:46 -04:00
Andrew Kelley ee525c92a4 langref: organize docs for inline loops and add note about when to use it 2018-06-19 17:21:08 -04:00
Andrew Kelley c7804277bf `@floatToInt` now has safety-checked undefined behavior
when the integer part does not fit in the destination integer type

 * Also fix incorrect safety triggered for integer casting an
   `i32` to a `u7`. closes #1138
 * adds compiler-rt function: `__floatuntidf`
2018-06-19 16:06:10 -04:00
Andrew Kelley 0b92d689d0 update langref 2018-06-19 12:16:59 -04:00
Andrew Kelley 85422d7aea
Merge pull request #1136 from alexnask/typeinfo_improvements
@typeInfo now uses optional types instead of @typeOf(undefined)
2018-06-19 11:46:32 -04:00
Andrew Kelley 9f2324389d
Merge pull request #1134 from ziglang/no-explicit-casting
remove "cast harder" casting syntax; add new casting builtins
2018-06-19 11:40:21 -04:00
Alexandros Naskos 811539f8ee Added missing ?type in docs. 2018-06-19 17:49:48 +03:00
Alexandros Naskos 1392313236 @typeInfo now uses optional types instead of @typeOf(undefined) 2018-06-19 17:45:19 +03:00
Andrew Kelley a3ddd0826b remove enum to/from int casting syntax; add `@enumToInt`/`@intToEnum`
see #1061
2018-06-19 03:50:38 -04:00
Andrew Kelley 626b73e8be remove error to/from int casting syntax; add `@errorToInt`/`@intToError`
See #1061
2018-06-18 18:48:29 -04:00
Andrew Kelley a430853a48 standard library fixes 2018-06-18 17:43:01 -04:00
Andrew Kelley 1aafbae5be remove []u8 casting syntax. add `@bytesToSlice` and `@sliceToBytes`
See #1061
2018-06-18 17:25:29 -04:00
Andrew Kelley 5d705fc6e3 remove error set casting syntax. add `@errSetCast`
See #1061
2018-06-18 15:01:42 -04:00
Andrew Kelley 1ca90b5856 zig fmt: support directories
zig fmt accepts any number of file paths. For each one, if it
is a file, then it formats the file. If it is a directory, then
zig recursively scans the directory, formatting all files that
end in `.zig`.

it maintains a map of paths that have been seen already, to avoid
softlink loops.

closes #1068
2018-06-18 13:58:08 -04:00
Andrew Kelley cd4676a233 stage1: update darwin code to workaround old libc bug
See #1128
2018-06-18 12:54:31 -04:00
Andrew Kelley 1aa93808b1 Merge branch 'binary132-fix-1117-macos-realpath' 2018-06-18 12:19:16 -04:00
Andrew Kelley 4ce36a6475 adjust logic for finding the path to zig executable on darwin 2018-06-18 12:18:39 -04:00
Andrew Kelley c09c3902c4 Merge branch 'fix-1117-macos-realpath' of https://github.com/binary132/zig into binary132-fix-1117-macos-realpath 2018-06-18 12:16:47 -04:00
Andrew Kelley 48985a7e68 langref: add docs for void
see #367
2018-06-18 12:02:30 -04:00
Andrew Kelley 8fd7cc11e1 disallow opaque as a return type of fn type syntax
closes #1115
2018-06-18 11:12:15 -04:00
Andrew Kelley d49d6f0cde fix compiler crash when using @intToFloat with float literal
closes #1132
2018-06-18 11:04:18 -04:00
Andrew Kelley 7151d72532
Merge pull request #1130 from ziglang/remove-bool-casting-syntax
remove bool to int syntax. add @boolToInt
2018-06-18 10:52:31 -04:00
Bodie Solomon c7057bd25b
Fix 1117: Revise realpath scratch logic 2018-06-18 07:40:31 -04:00