about summary refs log tree commit diff
path: root/lib/util/wordaccess_generic.h
blob: 6e0a20ef8492825d708ca51d4858ee518aafe968 (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 any of these
  conditions:

  * Compiler other than GCC
  * GCC before version 3.4
  * Requested 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);
}