VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/math/llroundf.cpp

Last change on this file was 98103, checked in by vboxsync, 17 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
RevLine 
[96117]1/* $Id: llroundf.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
[96118]3 * IPRT - No-CRT - llroundf().
[96117]4 */
5
6/*
[98103]7 * Copyright (C) 2022-2023 Oracle and/or its affiliates.
[96117]8 *
[96407]9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
[96117]11 *
[96407]12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
[96117]25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
[96407]27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
[96117]29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
[96407]33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
[96117]35 */
36
37
38/*********************************************************************************************************************************
39* Header Files *
40*********************************************************************************************************************************/
41#define IPRT_NO_CRT_FOR_3RD_PARTY
42#include "internal/nocrt.h"
43#include <iprt/nocrt/math.h>
44#include <iprt/nocrt/limits.h>
[96214]45#include <iprt/nocrt/fenv.h>
[96117]46
47
[96118]48#undef llroundf
49long long RT_NOCRT(llroundf)(float r32)
[96117]50{
51 if (isfinite(r32))
52 {
[96119]53 r32 = RT_NOCRT(roundf)(r32);
[96118]54 if (r32 >= (float)LLONG_MIN && r32 <= (float)LLONG_MAX)
[96196]55 return (long long)r32;
[96214]56 RT_NOCRT(feraiseexcept)(FE_INVALID);
[96196]57 return r32 > 0.0f ? LLONG_MAX : LLONG_MIN;
[96117]58 }
[96214]59 RT_NOCRT(feraiseexcept)(FE_INVALID);
[96196]60 if (RT_NOCRT(__isinff)(r32) && r32 < 0.0)
61 return LLONG_MIN;
[96118]62 return LLONG_MAX;
[96117]63}
[96118]64RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(llroundf);
[96117]65
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use