Update all #include directives to the currently preferred style.
[pspp-builds.git] / src / libpspp / integer-format.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2006, 2011 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef LIBPSPP_INTEGER_FORMAT_H
18 #define LIBPSPP_INTEGER_FORMAT_H 1
19
20 #include <byteswap.h>
21 #include <stdint.h>
22
23 #include "libpspp/str.h"
24
25 /* An integer format. */
26 enum integer_format
27   {
28     INTEGER_MSB_FIRST,          /* Big-endian: MSB at lowest address. */
29     INTEGER_LSB_FIRST,          /* Little-endian: LSB at lowest address. */
30     INTEGER_VAX,                /* VAX-endian: little-endian 16-bit words
31                                    in big-endian order. */
32
33     /* Native endianness. */
34 #ifdef WORDS_BIGENDIAN
35     INTEGER_NATIVE = INTEGER_MSB_FIRST
36 #else
37     INTEGER_NATIVE = INTEGER_LSB_FIRST
38 #endif
39   };
40
41 void integer_convert (enum integer_format, const void *,
42                       enum integer_format, void *,
43                       size_t);
44 uint64_t integer_get (enum integer_format, const void *, size_t);
45 void integer_put (uint64_t, enum integer_format, void *, size_t);
46
47 bool integer_identify (uint64_t expected_value, const void *, size_t,
48                        enum integer_format *);
49
50 #endif /* libpspp/integer-format.h */