64bit bitfields and sun solaris 8

Matthieu Patou mat at samba.org
Fri Nov 5 02:43:58 MDT 2010

Hi Love,

So I'm coming back on the subject of the bitfields
On 22/10/2010 07:23, Love Hörnquist Åstrand wrote:
> 21 okt 2010 kl. 14.41 skrev Matthieu Patou:
>> 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).
My proposal it the following:
diff --git a/source4/heimdal/lib/hcrypto/sha512.c 
index 18447b6..2352dec 100644
--- a/source4/heimdal/lib/hcrypto/sha512.c
+++ b/source4/heimdal/lib/hcrypto/sha512.c
@@ -158,11 +158,17 @@ swap_uint64_t (uint64_t t)
             ((temp & 0x0000ffff0000ffff) << 16);
+#if defined HAVE_BIG_BITFIELD
  struct x64{
      uint64_t a:64;
      uint64_t b:64;
+struct x64{
+    uint64_t a;
+    uint64_t b;

  SHA512_Update (SHA512_CTX *m, const void *v, size_t len)

> We really to figure out if we need bitfields at all, and if the byte swapping operations really make sense doing this way any more.
> Its really a performance optimization and should be treated as is, if it doesn't work, it should be taken out.
> Can we have this discussion on heimdal-discuss/and cross post, having it in two places will only confuse people.
So how do you propose to figure out to solve this problem ?
My understanding it that you are not sure that doing simply
struct x64 {
     uint64_t a;
     uint64_t b;
Will work always due to big endian/small endian issue and padding, am I 
right ?

When you talk about performance can you explain what the bitfields 
should bring ?


Matthieu Patou
Samba Team        http://samba.org
Private repo      http://git.samba.org/?p=mat/samba.git;a=summary

More information about the samba-technical mailing list