MySQL  8.0.16
Source Code Documentation
my_double2ulonglong.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
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, version 2.0,
6  as published by the Free Software Foundation.
7 
8  This program is also distributed with certain software (including
9  but not limited to OpenSSL) that is licensed under separate terms,
10  as designated in a particular file or component or in included license
11  documentation. The authors of MySQL hereby grant you an additional
12  permission to link the program and your derivative works with the
13  separately licensed software that they have included with MySQL.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License, version 2.0, for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23 
24 #ifndef MY_DOUBLE2ULONGLONG_INCLUDED
25 #define MY_DOUBLE2ULONGLONG_INCLUDED
26 
27 /**
28  @file include/my_double2ulonglong.h
29  Utility functions for converting between ulonglong and double.
30 */
31 
32 #include "my_inttypes.h"
33 
34 #ifdef _WIN32
35 inline unsigned long long my_double2ulonglong(double d) {
36  double t = d - (double)0x8000000000000000ULL;
37 
38  if (t >= 0) return ((unsigned long long)t) + 0x8000000000000000ULL;
39  return (unsigned long long)d;
40 }
41 #define double2ulonglong my_double2ulonglong
42 #endif /* _WIN32 */
43 
44 #ifndef ulonglong2double
45 #define ulonglong2double(A) ((double)(ulonglong)(A))
46 #define my_off_t2double(A) ((double)(my_off_t)(A))
47 #endif
48 #ifndef double2ulonglong
49 #define double2ulonglong(A) ((ulonglong)(double)(A))
50 #endif
51 
52 #endif // MY_DOUBLE2ULONGLONG_INCLUDED
Some integer typedefs for easier portability.
t
Definition: dbug_analyze.cc:147