From 08066a914ba575339376a74134256e032ba5adfb Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 29 Jun 2024 12:48:35 +0100 Subject: [PATCH] Fix `bit_field` docs --- content/docs/overview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/overview.md b/content/docs/overview.md index d27d58dc..f84b1683 100644 --- a/content/docs/overview.md +++ b/content/docs/overview.md @@ -2097,11 +2097,11 @@ Foo :: bit_field u16 { // backing type must be an integer or array of integers x: i32 | 3, // signed integers will be signed extended on use y: u16 | 2 + 3, // general expressions z: My_Enum | foo.SOME_CONSTANT, // ability to define the bit-width elsewhere - w: bool | foo.SOME_CONSTANT > 10 ? 2 : 1, + w: bool | 2 when foo.SOME_CONSTANT > 10 else 1, } v := Foo{} -v.x = 4 // truncates the value to fit into 3 bits +v.x = 3 // truncates the value to fit into 3 bits fmt.println(v.x) // accessing will convert `v.x` to an `i32` and do an appropriate sign extension ```