Remove "Written by Ben Pfaff <blp@gnu.org>" lines everywhere.
[pspp-builds.git] / src / libpspp / integer-format.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 2006 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or
5    modify it under the terms of the GNU General Public License as
6    published by the Free Software Foundation; either version 2 of the
7    License, or (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    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, write to the Free Software
16    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17    02110-1301, USA. */
18
19 #ifndef LIBPSPP_INTEGER_FORMAT_H
20 #define LIBPSPP_INTEGER_FORMAT_H 1
21
22 #include <byteswap.h>
23 #include <stdint.h>
24
25 #include <libpspp/str.h>
26
27 /* An integer format. */
28 enum integer_format
29   {
30     INTEGER_MSB_FIRST,          /* Big-endian: MSB at lowest address. */
31     INTEGER_LSB_FIRST,          /* Little-endian: LSB at lowest address. */
32     INTEGER_VAX,                /* VAX-endian: little-endian 16-bit words
33                                    in big-endian order. */
34
35     /* Native endianness. */
36 #ifdef WORDS_BIGENDIAN
37     INTEGER_NATIVE = INTEGER_MSB_FIRST
38 #else
39     INTEGER_NATIVE = INTEGER_LSB_FIRST
40 #endif
41   };
42
43 void integer_convert (enum integer_format, const void *, 
44                       enum integer_format, void *,
45                       size_t);
46 uint64_t integer_get (enum integer_format, const void *, size_t);
47 void integer_put (uint64_t, enum integer_format, void *, size_t);
48
49 bool integer_identify (uint64_t expected_value, const void *, size_t,
50                        enum integer_format *);
51
52 #endif /* libpspp/integer-format.h */