Commit graph

2305 commits

Author SHA1 Message Date
tgschultz
34a22a85ca altered all instances of readInt* in std.io (and std.debug) to consume the minimum byte size required instead of @sizeOf(). 2019-06-10 17:10:35 -04:00
Ryan Liptak
05e92a51aa Use std.math.isPowerOfTwo across std lib 2019-06-10 16:42:39 -04:00
daurnimator
b0648bfbd3
std.heap.ArenaAllocator: use singly linked list 2019-06-10 15:41:40 +10:00
daurnimator
ddf7942aaa
std: Add singly linked list 2019-06-10 15:41:40 +10:00
daurnimator
ed41d10a06
std: existing LinkedList is actually a TailQueue 2019-06-10 15:41:40 +10:00
Andrew Kelley
9c2ed8d103
Merge pull request #2525 from daurnimator/uring
std: linux uring kernel interfaces
2019-06-10 00:43:47 -04:00
daurnimator
4565f50efe
std: add linux kernel definitions for io_uring 2019-06-10 14:40:54 +10:00
daurnimator
ae604b4464
std: add linux kernel_rwf type and preadv2+pwritev2 2019-06-10 14:40:54 +10:00
daurnimator
a712a5515d
std: testing.expectEqual on structs now works 2019-06-10 14:39:44 +10:00
Andrew Kelley
39bc82561a
fix array literal syntax 2019-06-10 00:39:40 -04:00
daurnimator
ebedc99ac1
std: add math.isPowerOfTwo 2019-06-10 14:39:40 +10:00
Andrew Kelley
af35b73b99
Merge branch 'sfc64' of https://github.com/Sahnvour/zig into Sahnvour-sfc64 2019-06-10 00:38:58 -04:00
Andrew Kelley
5017a1d895 fix build on macos 2019-06-10 00:35:27 -04:00
Andrew Kelley
b735764898
different array literal syntax when inferring the size
old syntax:  []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}

closes #1797
2019-06-09 19:26:32 -04:00
Sahnvour
69d9f322ee implementation of the Sfc64 RNG from PractRand 2019-06-09 15:25:21 +02:00
Sahnvour
8e0670198b allow comptime_int in math.shl and math.shr 2019-06-09 14:44:41 +02:00
Shawn Landden
720ed74413 add bcmp implementation as LLVM 9 now emits those
The optimizer will now convert calls to memcmp into a calls to bcmp
in some circumstances. Users who are building freestanding code (not
depending on the platform’s libc) without specifying -ffreestanding may
need to either pass -fno-builtin-bcmp, or provide a bcmp function.

http://llvm.org/docs/ReleaseNotes.html#non-comprehensive-list-of-changes-in-this-release
2019-06-08 17:24:30 -04:00
Andrew Kelley
fb5e03b983
Merge pull request #2628 from emekoi/error-unexpected
windows.unexpectedError prints a human friendly string
2019-06-06 12:37:51 -04:00
Andrew Kelley
a682b0acb6
Merge pull request #2630 from squeek502/hashmap-pow2
std.HashMap: optimize by taking advantage of power of two capacity
2019-06-06 12:26:27 -04:00
Ryan Liptak
8f4229a61c std.HashMap: use std.math.ceilPowerOfTwo 2019-06-05 23:36:51 -07:00
Ryan Liptak
656ac43735 std.HashMap: optimize indexing by avoiding modulo operator
x % y can be optimized if y is a power of two by doing x & (y-1) instead. HashMap already enforces power of two capacity, so we can take advantage of this optimization.
2019-06-05 23:26:48 -07:00
emekoi
26613bfa01 switched to fixed-length buffer for error messages 2019-06-05 17:34:58 -05:00
emekoi
0288034c2f fixed mismatched types 2019-06-05 15:30:01 -05:00
emekoi
ddfab40e30 updated std.c.{freebsd, netbsd} to usingnamespace 2019-06-05 16:06:21 -04:00
emekoi
0aabfb09f9 removed duplicate definitions 2019-06-05 14:57:20 -05:00
emekoi
b74bcc9d76 windows.unexpectedError prints a human friendly string 2019-06-05 14:42:36 -05:00
Andrew Kelley
ca989a95d3
Merge pull request #2617 from squeek502/ceil-power-of-two
std.math: Add ceilPowerOfTwo and ceilPowerOfTwoPromote
2019-06-04 23:24:34 -04:00
Ryan Liptak
a0d66fa1e6 std.math: Clarify ceilPowerOfTwo inputs and disallow zero as an input 2019-06-04 15:49:27 -07:00
Timon Kruiper
fd771ea9fb Added LineComment support when MultiLines are used in ArrayInit
also added the corresponding testcase
2019-06-04 12:44:50 -04:00
Andrew Kelley
7eb82b8651
std.os.mmap: update doc comments for previous commits 2019-06-04 12:31:20 -04:00
Andrew Kelley
a608ebaa50
Merge pull request #2581 from LemonBoy/misc-stuff
Miscellaneous stdlib changes
2019-06-04 12:30:38 -04:00
Ryan Liptak
9bed6e1bf9 std.math: Add ceilPowerOfTwo and ceilPowerOfTwoPromote
Closes #2426
2019-06-02 22:09:22 -07:00
tgschultz
3eca5a42e6 fixed Deserializer.alignToByte() and added test coverage 2019-06-01 20:34:10 -04:00
LemonBoy
46cbed621b Move dl_iterate_phdr to os.zig 2019-05-31 11:59:53 +02:00
LemonBoy
4b30e40a91 Remove length restriction in mmap wrapper 2019-05-31 11:48:42 +02:00
LemonBoy
51fc375b0d Correct flag definitions for arm64 2019-05-30 17:05:39 +02:00
LemonBoy
477ee9c8b9 Fix some syscalls on arm64 2019-05-30 16:28:33 +02:00
Andrew Kelley
8ca294c430
update load dynamic library test for std lib changes 2019-05-30 00:04:11 -04:00
tgschultz
8eaf1387c7 Fix fmt.zig handling of slices of slices
Discovered while calling testing.expectError on an error union with payload [][]const u8. Even though the payload was not going to be printed, the current format handling caused a compile error anyway because it couldn't be casted to []const u8. The new handling treats a []u8 as a string but otherwise treats the slice as a pointer.
2019-05-29 20:46:08 -04:00
tgschultz
f9e7bd2682 std.meta/trait: def/definition => decl/declaration
TypeInfo: defs/Definition => decls/Declarations
2019-05-29 20:43:07 -04:00
Andrew Kelley
01a4897da5
improve the libc of wasm32-freestanding target
* introduce wasm32-freestanding-musl .h files to fix
   conflicts with stddef.h and errno.h
 * fix an issue with zig build system regarding installation of
   webassembly libraries
 * add implementations to zig's libc:
   - strcmp
   - strncmp
   - strerror
   - strlen

See #514
2019-05-29 20:32:27 -04:00
Timon Kruiper
4e1f3a9ba3 Correct formatting for multiline string in arrays 2019-05-29 19:56:28 -04:00
NBonaparte
dab1dc79a7
LinuxDynLib: remove MAP_LOCKED flag 2019-05-29 19:48:36 -04:00
Andrew Kelley
345501a72d
Merge pull request #2567 from emekoi/fix-dynlib
remove allocator from DynLib
2019-05-29 19:41:16 -04:00
Andrew Kelley
c66a747045
Merge pull request #2546 from LemonBoy/sigaltstack
Add sigaltstack syscall for Linux
2019-05-29 19:38:01 -04:00
Andrew Kelley
bfc86776d5
run zig fmt to update use to usingnamespace 2019-05-29 19:09:58 -04:00
Andrew Kelley
8a4ee5942b
zig fmt: fix 2 bugs of mangling source files 2019-05-29 19:09:58 -04:00
Andrew Kelley
b7a82288ad
change use to usingnamespace
See #2014

`use` syntax is still accepted for now. `zig fmt` automatically
updates code. After a release cycle the old syntax will be removed.
2019-05-29 19:09:58 -04:00
LemonBoy
b8d1060f0a Add missing sigaltstack definition for darwin 2019-05-29 22:38:14 +02:00
LemonBoy
399e026cc0 Add sigaltstack wrapper in os.zig 2019-05-29 22:38:14 +02:00