64bit bitfields and sun solaris 8

Matthieu Patou mat at samba.org
Thu Oct 21 15:41:26 MDT 2010

Hello love,

Metze pointed me a discussion that you have on heimdal-discuss about sun 
studio 11 and the lack of support for 64bitfields.

My solution for this pb was to add this to

+#if defined HAVE_BIG_BITFIELD
  struct x64{
      uint64_t a:64;
      uint64_t b:64;
+struct x64{
+    uint64_t a;
+    uint64_t b;

and add a test to our configure to see if the compiler support 64bitfields:
+    conf.CHECK_CODE('''
+                        struct x64{
+                            uint64_t a:64;
+                            uint64_t b:64;
+                        };
+                        ''',
+                        msg = "Checking if support bitfield longer than 
+                        define = 'HAVE_BIG_BITFIELD',
+                        )

So in most of the cases on most plateforms this will lead to the use of 
64bitfields so far we have the pb only on sun sparc with sun studio (not 
with gcc).

Given the fact that the compiler is "sun studio" we cas expect the case 
to be limited to sparc (big endian), in theory we can have the problem 
as well on x86/x64 with sun compiler but I tend to think that this case 
will be pretty rare or non existant.

What do you think on my solution ?


Matthieu Patou
Samba Team        http://samba.org

More information about the samba-technical mailing list