unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob bc80c40be749ddedf33ec3ba707d9f32296bb158 1038 bytes (raw)
name: util/endian-util.h 	 # note: path name is non-authoritative(*)

 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
30
31
32
33
34
35
36
37
38
 
/* this file mimics the macros present in recent GCC and CLANG */

#ifndef _ENDIAN_UTIL_H
#define _ENDIAN_UTIL_H

/* This are prefixed with UTIL to avoid collisions
 *
 * You can use something like the following to define UTIL_BYTE_ORDER
 * in a configure script.
 */
#if 0
#include <stdio.h>
#include <stdint.h>
uint32_t test = 0x34333231;
int main() { printf("%.4s\n", (const char*)&test); return 0; }
#endif

#define UTIL_ORDER_BIG_ENDIAN	  4321
#define UTIL_ORDER_LITTLE_ENDIAN  1234


#if !defined(UTIL_BYTE_ORDER) || ((UTIL_BYTE_ORDER != UTIL_ORDER_BIG_ENDIAN) && \
				  (UTIL_BYTE_ORDER != UTIL_ORDER_LITTLE_ENDIAN))
#undef UTIL_BYTE_ORDER
#ifdef __BYTE_ORDER__
#  if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#    define UTIL_BYTE_ORDER UTIL_ORDER_LITTLE_ENDIAN
#  elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#    define UTIL_BYTE_ORDER UTIL_ORDER_BIG_ENDIAN
#  else
#    error "Unsupported __BYTE_ORDER__"
#  endif
#else
#  error "UTIL_BYTE_ORDER not correctly defined and __BYTE_ORDER__ not defined."
#endif
#endif

#endif

debug log:

solving bc80c40 ...
found bc80c40 in https://yhetil.org/notmuch.git/

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).