Add new udafs and RMR support to gsprintconsole_ves
[com/gs-lite.git] / include / byteswap.h
1 /* ------------------------------------------------
2  Copyright 2014 AT&T Intellectual Property
3  Licensed under the Apache License, Version 2.0 (the "License");
4  you may not use this file except in compliance with the License.
5  You may obtain a copy of the License at
6  
7  http://www.apache.org/licenses/LICENSE-2.0
8  
9  Unless required by applicable law or agreed to in writing, software
10  distributed under the License is distributed on an "AS IS" BASIS,
11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  See the License for the specific language governing permissions and
13  limitations under the License.
14  ------------------------------------------- */
15 #ifndef BYTESWAP_H
16 #define BYTESWAP_H
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21     
22 #include "gsconfig.h"
23 #include "gstypes.h"
24     
25     
26     gs_uint16_t gscpbswap16(gs_uint16_t);
27     gs_uint32_t gscpbswap32(gs_uint32_t);
28     gs_uint64_t gscpbswap64(gs_uint64_t);
29     
30 #ifdef __cplusplus
31 }
32 #endif
33
34 #undef ntohl
35 #undef ntohs
36 #undef htons
37 #undef htonl
38 #undef htonll
39 #undef ntohll
40
41
42 #define ntohs(x)        gscpbswap16((gs_uint16_t)(x))
43 #define ntohl(x)        gscpbswap32((gs_uint32_t)(x))
44 #define ntohll(x)       gscpbswap64((gs_uint64_t)(x))
45 #define htons(x)        gscpbswap16((gs_uint16_t)(x))
46 #define htonl(x)        gscpbswap32((gs_uint32_t)(x))
47 #define htonll(x)       gscpbswap64((gs_uint64_t)(x))
48
49 /* do nothing fo floating point numbers */
50 #define htonf(x)        (x)
51 #define ntohf(x)        (x)
52
53
54 #endif