Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: _BitInt(N) Date: Thu, 27 Nov 2025 15:59:13 -0800 Organization: None to speak of Lines: 29 Message-ID: <87ecpjhvse.fsf@example.invalid> References: <10dajlh$ko3c$1@dont-email.me> <87ms4c4bom.fsf@example.invalid> <10g08vm$1us25$1@dont-email.me> <10g1et7$2bmus$1@dont-email.me> <10g1j7h$2deh9$1@dont-email.me> <10g1qq9$2f8lb$4@dont-email.me> <10g28gm$2mf9s$1@dont-email.me> <10g2f2d$2oufq$1@dont-email.me> <10g2m3v$2s5sa$1@dont-email.me> <10g53au$3onvh$1@dont-email.me> <10g58pa$3r273$1@dont-email.me> <10g6bpp$60nh$1@dont-email.me> <10g6qek$bfrp$1@dont-email.me> <10g742m$ev96$2@dont-email.me> <10g779l$h980$1@dont-email.me> <10g7aci$icq7$1@dont-email.me> <10g7hm2$lpsu$1@dont-email.me> <10g7oqf$ojir$1@dont-email.me> <10g7ue4$r47b$1@dont-email.me> <10g9a0r$1a895$1@dont-email.me> <10g9fmh$1crf0$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 27 Nov 2025 23:59:18 +0000 (UTC) Injection-Info: dont-email.me; posting-host="9a975f671dd6ccb12b8572bec53e6d5a"; logging-data="2011892"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/2VcCzBff+C0NTJ0sBHnRJ" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:Ec9bPD3KcyjNJB94h3LA+DWEnIA= sha1:X2RuBfRj2w8T/UV+OsuqXTGKBZM= Xref: csiph.com comp.lang.c:395536 bart writes: > On 27/11/2025 10:43, David Brown wrote: [...] >> uint64_t get_exponent(double x) { >>     return ((union { double d; uint64_t u;}) { x }.u >> 52) >>              & ((1ull << (62 - 52 + 1)) - 1); >> } >> That compiles (with gcc on x86-64) to : >>     movq rax, xmm0 >>     shr rax, 52 >>     and eax, 2047 >>     ret >> There's nothing in C that suggests this must be put in memory or do >> anything more than this. > > (This only seems to work with gcc. Clang and MSVS don't like it.) How exactly did clang and msvs express their dislike? What versions are you using? On my systems, it works correctly with gcc 13.3.0, clang 18.1.3, tcc 0.9.27, Microsoft Visual Studio 2022 17.14.20. If your problem is that you're using older compilers that don't support compound literals, it would have saved some time if you had said so. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */