/src/server/include/my_byteorder.h
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef MY_BYTEORDER_INCLUDED |
2 | | #define MY_BYTEORDER_INCLUDED |
3 | | |
4 | | /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
5 | | |
6 | | This program is free software; you can redistribute it and/or modify |
7 | | it under the terms of the GNU General Public License as published by |
8 | | the Free Software Foundation; version 2 of the License. |
9 | | |
10 | | This program is distributed in the hope that it will be useful, |
11 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | | GNU General Public License for more details. |
14 | | |
15 | | You should have received a copy of the GNU General Public License |
16 | | along with this program; if not, write to the Free Software |
17 | | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ |
18 | | |
19 | | #include <string.h> |
20 | | |
21 | | /* |
22 | | Macro for reading 32-bit integer from network byte order (big-endian) |
23 | | from an unaligned memory location. |
24 | | */ |
25 | | #define int4net(A) (int32) (((uint32) ((uchar) (A)[3])) | \ |
26 | | (((uint32) ((uchar) (A)[2])) << 8) | \ |
27 | | (((uint32) ((uchar) (A)[1])) << 16) | \ |
28 | | (((uint32) ((uchar) (A)[0])) << 24)) |
29 | | |
30 | | /* |
31 | | Function-like macros for reading and storing in machine independent |
32 | | format (low byte first). There are 'korr' (assume 'corrector') variants |
33 | | for integer types, but 'get' (assume 'getter') for floating point types. |
34 | | */ |
35 | | #if (defined(__i386__) || defined(_M_IX86)) && !defined(WITH_UBSAN) |
36 | | #define MY_BYTE_ORDER_ARCH_OPTIMIZED |
37 | | #include "byte_order_generic_x86.h" |
38 | | #elif (defined(__x86_64__) || defined (_M_X64)) && !defined(WITH_UBSAN) |
39 | | #include "byte_order_generic_x86_64.h" |
40 | | #else |
41 | | #include "byte_order_generic.h" |
42 | | #endif |
43 | | |
44 | | /* |
45 | | Function-like macros for reading and storing in machine format from/to |
46 | | short/long to/from some place in memory V should be a variable (not on |
47 | | a register) and M a pointer to byte. |
48 | | */ |
49 | | #ifdef WORDS_BIGENDIAN |
50 | | #include "big_endian.h" |
51 | | #else |
52 | | #include "little_endian.h" |
53 | | #endif |
54 | | |
55 | | /* convenience helpers */ |
56 | | static inline float get_float(const void *from) |
57 | 0 | { |
58 | 0 | float to; |
59 | 0 | float4get(to, ((const uchar*)from)); |
60 | 0 | return to; |
61 | 0 | } Unexecuted instantiation: fuzz_json.c:get_float Unexecuted instantiation: json_lib.c:get_float Unexecuted instantiation: ctype-ucs2.c:get_float Unexecuted instantiation: ctype-utf8.c:get_float Unexecuted instantiation: ctype.c:get_float Unexecuted instantiation: dtoa.c:get_float Unexecuted instantiation: int2str.c:get_float Unexecuted instantiation: ctype-unidata.c:get_float Unexecuted instantiation: xml.c:get_float Unexecuted instantiation: ctype-mb.c:get_float Unexecuted instantiation: ctype-simple.c:get_float Unexecuted instantiation: ctype-uca.c:get_float Unexecuted instantiation: ctype-uca0900.c:get_float Unexecuted instantiation: ctype-uca1400.c:get_float Unexecuted instantiation: my_strtoll10.c:get_float Unexecuted instantiation: my_vsnprintf.c:get_float Unexecuted instantiation: strfill.c:get_float Unexecuted instantiation: strmake.c:get_float Unexecuted instantiation: strnmov.c:get_float Unexecuted instantiation: strxnmov.c:get_float Unexecuted instantiation: ctype-bin.c:get_float Unexecuted instantiation: ctype-latin1.c:get_float Unexecuted instantiation: my_malloc.c:get_float Unexecuted instantiation: my_static.c:get_float Unexecuted instantiation: my_thr_init.c:get_float Unexecuted instantiation: thr_mutex.c:get_float Unexecuted instantiation: thr_rwlock.c:get_float Unexecuted instantiation: psi_noop.c:get_float Unexecuted instantiation: my_error.c:get_float Unexecuted instantiation: my_getsystime.c:get_float Unexecuted instantiation: my_init.c:get_float Unexecuted instantiation: my_mess.c:get_float Unexecuted instantiation: my_once.c:get_float Unexecuted instantiation: my_symlink.c:get_float Unexecuted instantiation: my_sync.c:get_float Unexecuted instantiation: my_getpagesize.c:get_float Unexecuted instantiation: charset.c:get_float Unexecuted instantiation: errors.c:get_float Unexecuted instantiation: hash.c:get_float Unexecuted instantiation: mf_dirname.c:get_float Unexecuted instantiation: mf_loadpath.c:get_float Unexecuted instantiation: mf_pack.c:get_float Unexecuted instantiation: my_div.c:get_float Unexecuted instantiation: my_getwd.c:get_float Unexecuted instantiation: my_lib.c:get_float Unexecuted instantiation: my_open.c:get_float Unexecuted instantiation: my_read.c:get_float Unexecuted instantiation: array.c:get_float Unexecuted instantiation: charset-def.c:get_float Unexecuted instantiation: mf_qsort.c:get_float Unexecuted instantiation: my_alloc.c:get_float Unexecuted instantiation: bchange.c:get_float Unexecuted instantiation: bmove_upp.c:get_float Unexecuted instantiation: ctype-big5.c:get_float Unexecuted instantiation: ctype-cp932.c:get_float Unexecuted instantiation: ctype-czech.c:get_float Unexecuted instantiation: ctype-euc_kr.c:get_float Unexecuted instantiation: ctype-eucjpms.c:get_float Unexecuted instantiation: ctype-extra.c:get_float Unexecuted instantiation: ctype-gb2312.c:get_float Unexecuted instantiation: ctype-gbk.c:get_float Unexecuted instantiation: ctype-sjis.c:get_float Unexecuted instantiation: ctype-tis620.c:get_float Unexecuted instantiation: ctype-ujis.c:get_float Unexecuted instantiation: ctype-win1250ch.c:get_float Unexecuted instantiation: is_prefix.c:get_float Unexecuted instantiation: str2int.c:get_float Unexecuted instantiation: strend.c:get_float Unexecuted instantiation: strxmov.c:get_float Unexecuted instantiation: strmov_overlapp.c:get_float |
62 | | |
63 | | #endif /* MY_BYTEORDER_INCLUDED */ |