Commit Graph

2134 Commits

Author SHA1 Message Date
Andrew Kelley
2c25c8aeed docs: remove references to %% prefix operator
also cleanup the table of contents
2018-01-19 03:47:27 -05:00
Andrew Kelley
ea623f2d39 all doc code examples are now tested
improve color scheme of docs
make docs depend on no external files
fix broken example code in docs

closes #465
2018-01-19 03:21:47 -05:00
Andrew Kelley
4b64c777ee add compile error for shifting by negative comptime integer
closes #698
2018-01-18 17:47:21 -05:00
Andrew Kelley
0fc645ab70 emit a compile error for @panic called at compile time
closes #706
2018-01-18 17:15:36 -05:00
Andrew Kelley
0b8f19fcba fix null debug info for 0-length array type
closes #702
2018-01-18 15:08:20 -05:00
Andrew Kelley
0aae96b5f0 test: fix brace expansion test not checking invalid inputs 2018-01-18 11:41:20 -05:00
Andrew Kelley
a4e8e55908
Merge pull request #701 from Hejsil/fix-xor-with-zero
Fixed bigint_xor for none negative numbers
2018-01-17 10:24:27 -05:00
Jimmi Holst Christensen
1d6f54cc7d A few more none negative cases, just to be sure we've covered everything 2018-01-17 14:35:13 +01:00
Jimmi Holst Christensen
fa2c3be341 More tests, and fixed none negative bigint xor 2018-01-17 14:31:47 +01:00
Jimmi Holst Christensen
db0fc32ab2 fixed xor with zero 2018-01-17 14:00:27 +01:00
Andrew Kelley
2e6125bc66 ziglang.org home page no longer in this repo
update docs examples which use build-exe to be tested

See #465
2018-01-17 03:24:49 -05:00
Marc Tiehuis
7a3fd89d25 Add Sha3 hashing functions
These are on the slower side and could be improved. No performance optimizations
yet have been done.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
```

-- Sha3-256

```
Zig --release-fast
    93 Mb/s
Zig --release-safe
    99 Mb/s
Zig
    4 Mb/s
```

-- Sha3-512

```
Zig --release-fast
    49 Mb/s
Zig --release-safe
    54 Mb/s
Zig
    2 Mb/s
```

Interestingly, release-safe is producing slightly better code than
release-fast.
2018-01-17 21:19:45 +13:00
Marc Tiehuis
dfd5363494 Add throughput test program
Blake performance numbers for reference:

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
```

-- Blake2s

```
Zig --release-fast
    485 Mb/s
Zig --release-safe
    377 Mb/s
Zig
    11 Mb/s
```

-- Blake2b
```
Zig --release-fast
    616 Mb/s
Zig --release-safe
    573 Mb/s
Zig
    18 Mb/s
```
2018-01-17 21:19:45 +13:00
Marc Tiehuis
7af53d0826 Fix crypto exports 2018-01-17 21:19:45 +13:00
Andrew Kelley
1eda7e0fde docgen: support executing exe code examples
See #465
2018-01-17 01:50:35 -05:00
Andrew Kelley
5aefabe045 docgen: validate See Also sections
See #465
2018-01-17 00:22:53 -05:00
Andrew Kelley
2774fe8a1b docgen auto generates table of contents
See #465
2018-01-17 00:22:53 -05:00
Andrew Kelley
4bdfc8a10a fix error return traces pointing to off-by-one source line
See #651
2018-01-17 00:22:53 -05:00
Josh Wolfe
24c2ff5cae Revert "Buffer.toSliceCopy"
This reverts commit c58f5a4742.
2018-01-16 13:45:34 -07:00
Josh Wolfe
c58f5a4742 Buffer.toSliceCopy 2018-01-16 13:28:53 -07:00
Andrew Kelley
ee9ab15679
Merge pull request #695 from Hejsil/tranlate-c-fixes
Tranlate c fixes - undefined variable initialization and non-bool if statements
2018-01-16 10:32:37 -05:00
Jimmi Holst Christensen
3974b7d31d translate_c can now translate if statements on integers and floats 2018-01-16 15:48:28 +01:00
Jimmi Holst Christensen
f59dcc5546 Fixed tests for undefined variables 2018-01-16 15:21:48 +01:00
Andrew Kelley
8b280d5b31
Merge pull request #689 from zig-lang/blake2
Add Blake2X hash functions
2018-01-16 09:13:09 -05:00
Jimmi Holst Christensen
821cbd7a1b Output "undefined" on uninitialized variables 2018-01-16 15:01:02 +01:00
Marc Tiehuis
73b4f09845 Add crypto internal test functions 2018-01-17 00:20:20 +13:00
Marc Tiehuis
66a24c9c00 Merge branch 'master' into blake2 2018-01-17 00:20:06 +13:00
Marc Tiehuis
fa7b33549e Change crypto functions to fill a buffer
- Rename blake2x -> blake2
 - Fix blake2s truncated tests
2018-01-17 00:17:48 +13:00
Andrew Kelley
6a95b88d1b fix bigint remainder division
See #405
2018-01-16 03:09:44 -05:00
Andrew Kelley
84d8584c5b implement bigint div and rem
See #405
2018-01-16 02:22:19 -05:00
Andrew Kelley
92fc5947fc fix compiler crash related to @alignOf 2018-01-15 20:44:21 -05:00
Andrew Kelley
5a4968484b Merge branch 'wip-err-ret-trace' 2018-01-15 16:28:30 -05:00
Andrew Kelley
6ec9933fd8 fix getting debug info twice in default panic handler 2018-01-15 16:26:13 -05:00
Marc Tiehuis
4cf86b4a94 Add Blake2X hash functions
The truncated output variants currently are dependent on a more complete
bigint implementation in the compiler.
2018-01-15 23:14:13 +13:00
Andrew Kelley
c9ac607bd3 add builtin.have_error_return_tracing 2018-01-15 00:14:14 -05:00
Andrew Kelley
7b57454cc1 clean up error return tracing
* error return tracing is disabled in release-fast mode
 * add @errorReturnTrace
 * zig build API changes build return type from `void` to `%void`
 * allow `void`, `noreturn`, and `u8` from main. closes #535
2018-01-15 00:01:02 -05:00
Andrew Kelley
d973b40884 stack traces are a variable number of frames 2018-01-14 19:40:02 -05:00
Andrew Kelley
f0df2cdde9 error return traces use a zig-provided function to save binary size 2018-01-14 16:26:06 -05:00
Andrew Kelley
793f031c4c remove 32-bit windows from supported targets list
we still want to support it, but there are too many bugs
to claim that we support it right now.

See #537
2018-01-14 15:17:07 -05:00
Andrew Kelley
fa024f8092 error return trace pointer prefixes other params
instead of being last. This increases the chances that it can
remain in the same register between calls.
2018-01-14 14:35:43 -05:00
Andrew Kelley
971a6fc531 fix duplicate stack trace code 2018-01-14 10:19:21 -05:00
Andrew Kelley
e7e7625633
Merge pull request #687 from zig-lang/sha2
Add Sha2 functions
2018-01-13 21:38:29 -05:00
Marc Tiehuis
9be9f1ad20 Disable win32 tests for Sha2 + correct lengths 2018-01-14 09:58:30 +13:00
Marc Tiehuis
1f3ed5cf27 Change indexing variable types for crypto functions 2018-01-13 22:44:58 +13:00
Marc Tiehuis
2659ac01be Add Sha2 functions
We take the fastest time measurement taken across multiple runs. Tested
across multiple compiler flags and the best chosen.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```

See https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly.

```
Gcc -O2
    219 Mb/s
Clang -O2
    213 Mb/s
Zig --release-fast
    284 Mb/s
Zig --release-safe
    211 Mb/s
Zig
    6 Mb/s
```

```
Gcc -O2
    350 Mb/s
Clang -O2
    354 Mb/s
Zig --release-fast
    426 Mb/s
Zig --release-safe
    300 Mb/s
Zig
    11 Mb/s
```
2018-01-13 22:37:47 +13:00
Andrew Kelley
4551489b92 typecheck the panic function 2018-01-13 01:00:50 -05:00
Andrew Kelley
a2315cfbfc
Merge pull request #686 from zig-lang/md5-sha1
Add Md5 and Sha1 functions
2018-01-13 00:00:33 -05:00
Marc Tiehuis
51fdbf7f8c Add Md5 and Sha1 hash functions
Some performance comparisons to C.

We take the fastest time measurement taken across multiple runs.

The block hashing functions use the same md5/sha1 methods.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```

See https://www.nayuki.io/page/fast-md5-hash-implementation-in-x86-assembly:

```
gcc -O2
    661 Mb/s
clang -O2
    490 Mb/s
zig --release-fast and zig --release-safe
    570 Mb/s
zig
    50 Mb/s
```

See https://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly:

```
gcc -O2
    588 Mb/s
clang -O2
    563 Mb/s
zig --release-fast and zig --release-safe
    610 Mb/s
zig
    21 Mb/s
```

In short, zig provides pretty useful tools for writing this sort of
code. We are in the lead against clang (which uses the same LLVM
backend) with us being slower only against md5 with GCC.
2018-01-13 14:40:21 +13:00
Marc Tiehuis
304f6f1d01 Add integer rotation functions 2018-01-13 13:23:12 +13:00
Andrew Kelley
32ea6f54e5 *WIP* proof of concept error return traces 2018-01-12 02:12:11 -05:00