about summary refs log tree commit diff
path: root/lib/util/wordaccess_64_le.h
blob: 4d148ad2a3acdc64117404fd78a2150deefda885 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*=============================================================================
  This file is the part of wordaccess.h for use under these
  conditions:

  * GCC (>=3.4)  (__builtin_clz appears in GCC 3.4)
  * Little-Endian machines (IA64, X86-64, AMD64)
  * 64 bit long
 
=============================================================================*/

#include "intcode.h"

typedef uint64_t wordint;
typedef unsigned char wordintBytes[sizeof(wordint)];


static __inline__ wordint
bytesToWordint(wordintBytes const bytes) {
    return (wordint) pm_uintFromBigend64(*(bigend64*)bytes);
}



static __inline__ void
wordintToBytes(wordintBytes * const bytesP,
               wordint        const wordInt) {
     *(bigend64*)bytesP = pm_bigendFromUint64(wordInt);
}