From 6eabf197e2253374f2244569adf9eaf921c971e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Dee=20=28J=C5=8Dshin=29?= Date: Wed, 19 Jun 2024 08:19:11 -0700 Subject: [PATCH] Refer to union members in initializers These two functions are the primitive pseudo-constructors for the struct fields in the union; as such, it does not make sense for them to use the checked accessors. --- ctl/string.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ctl/string.h b/ctl/string.h index 6be9c5416..84aac204b 100644 --- a/ctl/string.h +++ b/ctl/string.h @@ -332,16 +332,16 @@ class string { if (size > __::sso_max) __builtin_trap(); - *(blob + __::sso_max) = (__::sso_max - size); + __s.rem = __::sso_max - size; } void set_big_string(char* const p, const size_t n, const size_t c2) noexcept { if (c2 > __::big_mask) __builtin_trap(); - *(char**)blob = p; - *(((size_t*)blob) + 1) = n; - *(((size_t*)blob) + 2) = c2 | ~__::big_mask; + __b.p = p; + __b.n = n; + __b.c = c2 | ~__::big_mask; } __::small_string* small() noexcept