1 | /* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
2 | |
3 | This program is free software; you can redistribute it and/or modify |
4 | it under the terms of the GNU General Public License, version 2.0, |
5 | as published by the Free Software Foundation. |
6 | |
7 | This program is also distributed with certain software (including |
8 | but not limited to OpenSSL) that is licensed under separate terms, |
9 | as designated in a particular file or component or in included license |
10 | documentation. The authors of MySQL hereby grant you an additional |
11 | permission to link the program and your derivative works with the |
12 | separately licensed software that they have included with MySQL. |
13 | |
14 | Without limiting anything contained in the foregoing, this file, |
15 | which is part of C Driver for MySQL (Connector/C), is also subject to the |
16 | Universal FOSS Exception, version 1.0, a copy of which can be found at |
17 | http://oss.oracle.com/licenses/universal-foss-exception. |
18 | |
19 | This program is distributed in the hope that it will be useful, |
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22 | GNU General Public License, version 2.0, for more details. |
23 | |
24 | You should have received a copy of the GNU General Public License |
25 | along with this program; if not, write to the Free Software |
26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
27 | |
28 | /* |
29 | Optimized functions for the x86 architecture (_WIN32 included). |
30 | |
31 | x86 handles misaligned reads and writes just fine, so suppress |
32 | UBSAN warnings for these functions. |
33 | */ |
34 | static inline int16 sint2korr(const uchar *A) SUPPRESS_UBSAN; |
35 | static inline int16 sint2korr(const uchar *A) { return *((int16*) A); } |
36 | |
37 | static inline int32 sint4korr(const uchar *A) SUPPRESS_UBSAN; |
38 | static inline int32 sint4korr(const uchar *A) { return *((int32*) A); } |
39 | |
40 | static inline uint16 uint2korr(const uchar *A) SUPPRESS_UBSAN; |
41 | static inline uint16 uint2korr(const uchar *A) { return *((uint16*) A); } |
42 | |
43 | static inline uint32 uint4korr(const uchar *A) SUPPRESS_UBSAN; |
44 | static inline uint32 uint4korr(const uchar *A) { return *((uint32*) A); } |
45 | |
46 | static inline ulonglong uint8korr(const uchar *A) SUPPRESS_UBSAN; |
47 | static inline ulonglong uint8korr(const uchar *A) { return *((ulonglong*) A);} |
48 | |
49 | static inline longlong sint8korr(const uchar *A) SUPPRESS_UBSAN; |
50 | static inline longlong sint8korr(const uchar *A) { return *((longlong*) A); } |
51 | |
52 | static inline void int2store(uchar *T, uint16 A) SUPPRESS_UBSAN; |
53 | static inline void int2store(uchar *T, uint16 A) |
54 | { |
55 | *((uint16*) T)= A; |
56 | } |
57 | |
58 | static inline void int4store(uchar *T, uint32 A) SUPPRESS_UBSAN; |
59 | static inline void int4store(uchar *T, uint32 A) |
60 | { |
61 | *((uint32*) T)= A; |
62 | } |
63 | |
64 | static inline void int8store(uchar *T, ulonglong A) SUPPRESS_UBSAN; |
65 | static inline void int8store(uchar *T, ulonglong A) |
66 | { |
67 | *((ulonglong*) T)= A; |
68 | } |
69 | |