home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,194 of 243,242   
   Keith Thompson to bart   
   Re: _BitInt(N)   
   27 Nov 25 15:59:13   
   
   From: Keith.S.Thompson+u@gmail.com   
      
   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 */   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca