about summary refs log tree commit diff
path: root/lib/util/wordaccess_generic.h
blob: 94cc81246466727bf0618c275cd732351fb814ac (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
29
/*=============================================================================

  This file is the part of wordaccess.h for use under these
  conditions:

  * Compilers other than GCC
  * GCC before version 3.4
  * Specified by the user with WORDACCESS_GENERIC
=============================================================================*/

#include "intcode.h"

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

    
static __inline__ wordint
bytesToWordint(wordintBytes  const bytes) {

    return (wordint)  pm_uintFromBigend32( * (bigend32*) bytes);
}


static __inline__ void
wordintToBytes(wordintBytes * const bytesP,
               wordint    const wordInt) {

    * (bigend32*) bytesP = pm_bigendFromUint32((uint32_t)wordInt);
}