Commit Graph

64 Commits

Author SHA1 Message Date
Andrew Kelley
d29871977f remove redundant license headers from zig standard library
We already have a LICENSE file that covers the Zig Standard Library. We
no longer need to remind everyone that the license is MIT in every single
file.

Previously this was introduced to clarify the situation for a fork of
Zig that made Zig's LICENSE file harder to find, and replaced it with
their own license that required annual payments to their company.
However that fork now appears to be dead. So there is no need to
reinforce the copyright notice in every single file.
2021-08-24 12:25:09 -07:00
Tau
8d0671157c Correct hasUniqueRepresentation for vectors
Closes #9333.
2021-07-21 15:19:57 -04:00
Jacob G-W
9fffffb07b fix code broken from previous commit 2021-06-21 17:03:03 -07:00
Jacob G-W
641ecc260f std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
Andrew Kelley
193c529b8c CLI: rename --override-lib-dir to --zig-lib-dir
This breaking change disambiguates between overriding the lib dir when
performing an installation with the Zig Build System, and overriding the
lib dir that the Zig installation itself uses.
2021-06-14 11:33:27 -07:00
Isaac Freund
2d4c439652 std: fix auto hash of tagged union with void field 2021-06-14 12:14:04 +03:00
Isaac Freund
5b850d5c92
Run zig fmt on src/ and lib/std/
This replaces callconv(.Inline) with the more idiomatic inline keyword.
2021-05-20 17:14:18 +02:00
Andrew Kelley
83677074f9 std: update regarding std.builtin reorganization
There are also some regressed std.fmt tests here and I haven't figured
out what's wrong yet.
2021-05-17 16:08:09 -07:00
Andrew Kelley
5619ce2406 Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
 * doc/langref.html.in
 * lib/std/enums.zig
 * lib/std/fmt.zig
 * lib/std/hash/auto_hash.zig
 * lib/std/math.zig
 * lib/std/mem.zig
 * lib/std/meta.zig
 * test/behavior/alignof.zig
 * test/behavior/bitcast.zig
 * test/behavior/bugs/1421.zig
 * test/behavior/cast.zig
 * test/behavior/ptrcast.zig
 * test/behavior/type_info.zig
 * test/behavior/vector.zig

Master branch added `try` to a bunch of testing function calls, and some
lines also had changed how to refer to the native architecture and other
`@import("builtin")` stuff.
2021-05-08 14:45:21 -07:00
Veikka Tuominen
fd77f2cfed std: update usage of std.testing 2021-05-08 15:15:30 +03:00
Andrew Kelley
c60d8f017e std: remove redundant comptime keyword
@g-w1's fancy new compile error in action
2021-04-28 22:58:12 -07:00
Andrew Kelley
429cd2b5dd std: change @import("builtin") to std.builtin 2021-04-15 19:06:39 -07:00
Joris Hartog
5e40560367 Specify type in autoHash error message
This commit simply specifies the type which `autoHash` can't hash in the
compile error.

Closes #7970.
2021-03-21 23:07:02 +02:00
Tadeo Kondrak
5dfe0e7e8f
Convert inline fn to callconv(.Inline) everywhere 2021-02-10 20:06:12 -07:00
Tadeo Kondrak
0b5f3c2ef9
Replace @TagType uses, mostly with std.meta.Tag 2021-01-30 22:26:44 +02:00
Andrew Kelley
0c8e2c987d std CityHash: disable memory-expensive tests for now 2021-01-11 13:58:06 -07:00
Martin Wickham
21213127ec Modify cityhash to work at comptime 2021-01-11 13:52:52 -07:00
Andrew Kelley
44c9bf559b std: disable a couple tests on windows
They are passing but we're hitting OOM on the Windows CI server. This is
to buy us more time until stage2 rescues us from the CI memory crisis.
2021-01-02 12:21:19 -07:00
Frank Denis
6c2e0c2046 Year++ 2020-12-31 15:45:24 -08:00
Julius Putra Tanu Setiaji
f9506e9155 Handle unions in autoHash 2020-12-26 19:43:15 +08:00
Julius Putra Tanu Setiaji
d9133b9ae0 Also check whether structs contain slices 2020-12-26 12:58:52 +08:00
LemonBoy
135f4791e5 std: Don't hash undefined bits
auto_hash must be extra careful when hashing integers whose bit size is
not a multiple of 8 as, when reinterpreted with mem.asBytes, may contain
undefined non-zero bits too.
2020-12-17 12:00:48 +01:00
breakin
6d3c176c12 Change seed for Murmur2_64 from u32 to u64 2020-11-18 17:05:38 -08:00
Jan Prudil
aadccc4206 Make std.meta.Int accept a signedness parameter 2020-10-17 14:09:59 +02:00
Veikka Tuominen
d073836894
Merge pull request #6172 from tadeokondrak/@Type(.Union)
Implement @Type for Union
2020-09-14 16:43:49 +03:00
LemonBoy
61e9e82bdc std: Make the CRC32 calculation slightly faster
Speed up a little the slicing-by-8 code path by replacing the
(load+shift+xor)*4 sequence with a single u32 load plus a xor.

Before:

```
iterative:  1018 MiB/s [000000006c3b110d]
small keys:  1075 MiB/s [0035bf3dcac00000]
```

After:

```
iterative:  1114 MiB/s [000000006c3b110d]
small keys:  1324 MiB/s [0035bf3dcac00000]
```
2020-09-13 16:32:21 -04:00
Tadeo Kondrak
771f35c593
Use less inefficient method of replacing TypeInfo.UnionField.enum_field 2020-09-07 06:23:27 -06:00
Tadeo Kondrak
ac19ccf595
Update standard library for removal of TypeInfo.UnionField.enum_field 2020-09-07 06:23:26 -06:00
Vexu
1df0f3ac24
update uses of deprecated type field access 2020-09-03 18:10:40 +03:00
Frank Denis
e919744c7a Promote hash/siphash to crypto/siphash
SipHash *is* a cryptographic function, with a 128-bit security level.

However, it is not a regular hash function: a secret key is required,
and knowledge of that key allows collisions to be quickly computed offline.

SipHash is therefore more suitable to be used as a MAC.

The same API as other MACs was implemented in addition to functions directly
returning an integer.

The benchmarks have been updated accordingly.

No changes to the SipHash implementation itself.
2020-08-22 02:47:50 -04:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Vexu
13e472aa2a
translate-c: add return if one is needed 2020-08-13 18:40:14 +03:00
Sahnvour
f67ce1e35f make use of hasUniqueRepresentation to speed up hashing facilities, fastpath in getAutoHashFn is particularly important for hashmap performance
gives a 1.18x speedup on gotta-go-fast hashmap bench
2020-07-26 23:04:33 +02:00
Sahnvour
345cb3200c improve autoHash type switch
floats shouldn't be autoHash'd as they have multiple representations for some values, preventing it by default is safer
2020-07-26 22:04:10 +02:00
Vexu
e85fe13e44
run zig fmt on std lib and self hosted 2020-07-11 20:41:19 +03:00
data-man
77bb2dc094 Use writer in benchmarks 2020-06-25 19:07:25 -04:00
data-man
3c4abacba6 Optimization of vectors hashing 2020-05-06 17:08:49 +05:00
Tadeo Kondrak
350b2adacd
std.meta.IntType -> std.meta.Int 2020-04-28 19:11:31 -06:00
Tadeo Kondrak
f977155fdb
@Vector -> std.meta.Vector 2020-04-28 00:47:13 -06:00
Timon Kruiper
c829f2f7b7 Add mips support to standard library 2020-04-24 15:28:55 -04:00
Ryan Liptak
08a9ab4d8c Update all remaining uses of &outStream().stream 2020-04-03 12:12:23 -04:00
Michaël Larouche
a5af78c376 Fix porting of zlib alder32 with large input 2020-03-31 20:08:42 -04:00
Andrew Kelley
f614d94faa
update std lib to take advantage of slicing with comptime indexes 2020-03-19 14:48:47 -04:00
Andrew Kelley
7fa88cc0a6
std lib fixups for new semantics
std lib tests are passing now
2020-03-19 09:53:55 -04:00
xackus
00be934569 short std.builtin enum literals in std lib 2020-03-01 13:57:41 -05:00
Vexu
538d9a5dd8
remove uses of @ArgType and @IntType 2020-02-24 23:39:03 +02:00
LemonBoy
3640c682a2 Run zig fmt 2020-02-01 11:32:53 +01:00
Benjamin Feng
b7a236d68e Convert a bunch of page_allocator to testing.allocator 2020-01-29 22:22:01 -06:00
Andrew Kelley
d8e2549996
remove invalid use of allowzero in std.crypto.murmur 2020-01-27 19:42:13 -05:00
daurnimator
9e6e1e58bb std: use non-exhaustive enums from crc module
Un-reverts PR #3118
2020-01-18 17:42:45 -05:00