Commit Graph

1094 Commits

Author SHA1 Message Date
Marc Tiehuis
c32b2e45ef compiler_rt: Add floatuntisf 2018-06-30 21:58:59 +12:00
Marc Tiehuis
379950f81d compiler_rt: Add trunc f128 narrowing functions 2018-06-30 21:58:59 +12:00
Andrew Kelley
0874a5ba77 std.atomic.queue - document limitation and add MPSC queue 2018-06-29 14:45:42 -04:00
tgschultz
3e94347e61 Fix up some std.rand syntax #1161 (#1162)
* Fix old syntax in rand

Ziggurat somehow did not get updated to latest syntax

* Fix broken float casts

f32 float casts somehow not updated to latest syntax
2018-06-27 12:30:15 -04:00
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
Andrew Kelley
3290e72833 std.zig.ast: fix incorrect impl of FnProto.firstToken
closes #1151
2018-06-25 11:54:10 -04:00
Andrew Kelley
5f38d6e2e9 add casting docs, __extenddftf2, and __extendsftf2 2018-06-21 14:44:35 -04:00
Marc Tiehuis
f50c0c664f Add float repr bit extraction functions 2018-06-21 01:45:12 -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
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
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
4210f1f6a0 remove bool to int syntax. add @boolToInt
add missing docs

See #1061
2018-06-18 03:07:16 -04:00
Andrew Kelley
906ed059ce update std.DynLib to use @intCast 2018-06-18 00:52:55 -04:00
Andrew Kelley
7912061226 remove integer and float casting syntax
* add `@intCast`
 * add `@floatCast`
 * add `@floatToInt`
 * add `@intToFloat`

See #1061
2018-06-17 02:57:07 -04:00
Andrew Kelley
06a26f0965 std.Complex: use better arg passing convention and fix a TODO 2018-06-16 21:32:53 -04:00
Andrew Kelley
751518787a
Merge pull request #1109 from ziglang/pass-by-non-copying-value
allow passing by non-copying value
2018-06-16 21:13:10 -04:00
Andrew Kelley
3ee4d23ebd posix read can return error.IsDir 2018-06-16 19:54:16 -04:00
Andrew Kelley
e311cd562b don't automatically take pointer when passing by non-copying value
this commit does not have all tests passing
2018-06-16 19:37:00 -04:00
Andrew Kelley
65d04cbeb4 std.DynLib: open the fd with CLOEXEC 2018-06-16 17:27:45 -04:00
Andrew Kelley
48de57d824 add basic std lib code for loading dynamic libraries
this is going to only work for very basic libraries;
I plan to slowly add more features over time to support more
complicated libraries
2018-06-16 17:01:23 -04:00
Andrew Kelley
cdf1e366f9 fix build on windows, broken by previous commit 2018-06-14 16:36:07 -04:00
Andrew Kelley
6943cefebf std.os.path.dirname: return null instead of empty slice
for when there is no directory component. Makes it harder
to write bugs.

closes #1017
2018-06-14 16:15:32 -04:00
Andrew Kelley
2219cc0612
Merge pull request #1105 from ziglang/i128-compiler-rt
Add i128 compiler-rt div/mul support
2018-06-14 10:59:38 -04:00
Marc Tiehuis
a369d69c51 Add windows x86_64 i128 abi workaround 2018-06-14 21:18:36 +12:00
Andrew Kelley
fc87f6e417 fix race condition bug in test harness of std.atomic 2018-06-13 11:57:57 -04:00
Andrew Kelley
e1f56c9af6 std.zig.ast: add test for iterate
closes #1101
2018-06-13 11:48:06 -04:00
Marc Tiehuis
9110140514 Add i128 compiler-rt div/mul support 2018-06-13 22:25:04 +12:00
Andrew Kelley
fdd9cf0928 better debugging for CI failures of std.atomic 2018-06-12 15:14:32 -04:00
Andrew Kelley
7580e39b38 zig fmt 2018-06-12 02:18:11 -04:00
Andrew Kelley
3dd9af9948 implement std.os.Dir for windows
improve std.os.File.access so that it does not depend on shlwapi.dll

closes #1084
2018-06-12 01:57:09 -04:00
tgschultz
854f90aa30 Added C string support to fmt by using "{s}". The format string requirement is for saftey. (#1092) 2018-06-10 12:57:21 -04:00
Marc Tiehuis
dc8bda7e02 Add arbitrary-precision integer to std
A few notes on the implementation:

 - Any unsigned power of two integer type less than 64 bits in size is supported
 as a Limb type.
 - The algorithms used are kept simple for the moment. More complicated
 algorithms are generally only more useful as integer sizes increase a
 lot and I don't expect our current usage to be used for this purpose
 just yet.
 - All branches (practically) have been covered by tests.

See 986a2b3243/bench
for rough performance comparison numbers.

Closes #364.
2018-06-10 18:24:34 +12:00
Andrew Kelley
0a95b0f1ff std.zig: update syntax for orelse keyword 2018-06-10 01:18:31 -04:00
Andrew Kelley
77678b2cbc
breaking syntax change: orelse keyword instead of ?? (#1096)
use the `zig-fmt-optional-default` branch to have zig fmt
automatically do the changes.

closes #1023
2018-06-10 01:13:51 -04:00
Andrew Kelley
ec1b6f6673
breaking syntax change: ??x to x.? (#1095)
See #1023

This also renames Nullable/Maybe to Optional
2018-06-09 23:42:14 -04:00
marleck55
7a9635555b std/fmt: Use lowercase k for kilo in base 1000 (#1090) 2018-06-09 12:05:58 -04:00
Andrew Kelley
fc6446702e clean up std.ArrayList
* add `std.debug.assertError`
 * `std.ArrayList` update everything to follow `self` convention
 * rename `std.ArrayList.set` to `std.ArrayList.setOrError`
 * add `std.ArrayList.set` which asserts

Before 1.0.0 we might remove some of this API, because you can use
`toSlice()` for everything, but it's ok to add these functions as
an experiment before then.
2018-06-09 12:03:11 -04:00
Arthur Elliott
e0092ee4a5 add set function to arraylist
so you can set a value without growing the underlying buffer,
with range safety checks
2018-06-09 11:42:41 -04:00
isaachier
1a9d2f3aae Fix error handling in Buffer::fromOwnedSlice (#1082) 2018-06-08 19:24:48 -04:00
Marc Tiehuis
ffb089a9f5 Fix json parser comma after empty object case 2018-06-08 17:43:13 +12:00
Andrew Kelley
b11c5d8f82
fix std.os.windows.PathFileExists specified in the wrong DLL (#1066)
closes #1054
2018-06-06 15:36:47 -04:00
isaachier
4fc601895b Fix const-ness of buffer in replaceContents method (#1065) 2018-06-06 14:09:47 -04:00