QDP++
qdp_byteorder.h
Go to the documentation of this file.
1// -*- C++ -*-
2
6
7#ifndef __qdp_byteorder_h__
8#define __qdp_byteorder_h__
9
10#include <cstdio>
11
12namespace QDPUtil
13{
14#if 0
15 // #include <qdp_stdint.h>
16#else
17 // NEED PROPER CONSTRUCTION OF TYPES
19 typedef unsigned short int n_uint16_t;
20 typedef unsigned int n_uint32_t;
21#endif
22
23
25 n_uint32_t crc32(n_uint32_t crc, const unsigned char *buf, size_t len);
26
28 n_uint32_t crc32(n_uint32_t crc, const char *buf, size_t len);
29
31 bool big_endian();
32
34 void byte_swap(void *ptr, size_t size, size_t nmemb);
35
37 size_t bfread(void *ptr, size_t size, size_t nmemb, FILE *stream);
38
40 size_t bfwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
41}
42
43#endif
n_uint32_t crc32(n_uint32_t crc, const unsigned char *buf, size_t len)
crc32
Definition qdp_crc32.cc:184
unsigned int n_uint32_t
void byte_swap(void *ptr, size_t size, size_t nmemb)
Byte-swap an array of data each of size nmemb.
size_t bfread(void *ptr, size_t size, size_t nmemb, FILE *stream)
fread on a binary file written in big-endian order
bool big_endian()
Is the native byte order big endian?
size_t bfwrite(void *ptr, size_t size, size_t nmemb, FILE *stream)
fwrite to a binary file in big-endian order
unsigned short int n_uint16_t
See qdp_crc32.cc for defs and discussion.