diff options
| author | Vexu <15308111+Vexu@users.noreply.github.com> | 2019-11-13 00:25:44 +0200 |
|---|---|---|
| committer | Vexu <15308111+Vexu@users.noreply.github.com> | 2019-11-13 00:25:44 +0200 |
| commit | 110ef2e52825656fc048cba020f0fc36a1e58d13 (patch) | |
| tree | cae3ae95a6ce44f85650c44b90365f7cc5cb4045 /doc | |
| parent | 956ba8b0e7ada08f2f85cd41ee73af6453db0c16 (diff) | |
| download | zig-110ef2e52825656fc048cba020f0fc36a1e58d13.tar.gz zig-110ef2e52825656fc048cba020f0fc36a1e58d13.zip | |
add @atomicStore builtin
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/langref.html.in | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in index b0003a714b..f5fbb4e3a3 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -6612,14 +6612,14 @@ async fn func(y: *i32) void { This builtin function atomically dereferences a pointer and returns the value. </p> <p> - {#syntax#}T{#endsyntax#} must be a pointer type, a {#syntax#}bool{#endsyntax#}, - or an integer whose bit count meets these requirements: + {#syntax#}T{#endsyntax#} must be a pointer type, a {#syntax#}bool{#endsyntax#} + an integer whose bit count meets these requirements: </p> <ul> <li>At least 8</li> <li>At most the same as usize</li> <li>Power of 2</li> - </ul> + </ul> or an enum with a valid integer tag type. <p> TODO right now bool is not accepted. Also I think we could make non powers of 2 work fine, maybe we can remove this restriction @@ -6660,6 +6660,25 @@ async fn func(y: *i32) void { <li>{#syntax#}.Min{#endsyntax#} - stores the operand if it is smaller. Supports integers and floats.</li> </ul> {#header_close#} + {#header_open|@atomicStore#} + <pre>{#syntax#}@atomicStore(comptime T: type, ptr: *T, value: T, comptime ordering: builtin.AtomicOrder) void{#endsyntax#}</pre> + <p> + This builtin function atomically stores a value. + </p> + <p> + {#syntax#}T{#endsyntax#} must be a pointer type, a {#syntax#}bool{#endsyntax#} + an integer whose bit count meets these requirements: + </p> + <ul> + <li>At least 8</li> + <li>At most the same as usize</li> + <li>Power of 2</li> + </ul> or an enum with a valid integer tag type. + <p> + TODO right now bool is not accepted. Also I think we could make non powers of 2 work fine, maybe + we can remove this restriction + </p> + {#header_close#} {#header_open|@bitCast#} <pre>{#syntax#}@bitCast(comptime DestType: type, value: var) DestType{#endsyntax#}</pre> <p> |
