2012-04-13 01:08:20 +00:00
|
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2017-01-15 17:09:59 +00:00
|
|
|
|
// Copyright 2003-2017 by Wilson Snyder. This program is free software; you can
|
2006-08-26 11:35:28 +00:00
|
|
|
|
// redistribute it and/or modify it under the terms of either the GNU
|
2009-05-04 21:07:57 +00:00
|
|
|
|
// Lesser General Public License Version 3 or the Perl Artistic License.
|
|
|
|
|
// Version 2.0.
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//
|
|
|
|
|
// Verilator is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
2008-06-10 01:25:10 +00:00
|
|
|
|
//
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//*************************************************************************
|
|
|
|
|
///
|
|
|
|
|
/// \file
|
|
|
|
|
/// \brief Verilator: Common include for OS portability (verilated & verilator)
|
|
|
|
|
///
|
2006-12-18 19:20:45 +00:00
|
|
|
|
/// This header is used by both the Verilator source code (run on the
|
|
|
|
|
/// build and host system), and the Verilated output (run on the target
|
|
|
|
|
/// system). Code needed by only the host system goes into
|
|
|
|
|
/// config_build.h.in, code needed by Verilated code only goes into
|
|
|
|
|
/// verilated.h, and code needed by both goes here (verilatedos.h).
|
2006-08-26 11:35:28 +00:00
|
|
|
|
///
|
2008-04-25 12:14:27 +00:00
|
|
|
|
/// Code available from: http://www.veripool.org/verilator
|
2006-08-26 11:35:28 +00:00
|
|
|
|
///
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _VERILATEDOS_H_
|
|
|
|
|
#define _VERILATEDOS_H_ 1 ///< Header Guard
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Compiler pragma abstraction
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
|
# define VL_ATTR_ALIGNED(alignment) __attribute__ ((aligned (alignment)))
|
2010-02-04 00:19:18 +00:00
|
|
|
|
# define VL_ATTR_ALWINLINE __attribute__ ((always_inline))
|
2006-08-26 11:35:28 +00:00
|
|
|
|
# define VL_ATTR_NORETURN __attribute__ ((noreturn))
|
2010-02-04 13:38:00 +00:00
|
|
|
|
# ifdef _WIN32
|
|
|
|
|
# define VL_ATTR_PRINTF(fmtArgNum) // GCC with MS runtime will fool the print arg checker
|
|
|
|
|
# else
|
|
|
|
|
# define VL_ATTR_PRINTF(fmtArgNum) __attribute__ ((format (printf, fmtArgNum, fmtArgNum+1)))
|
|
|
|
|
# endif
|
2006-08-26 11:35:28 +00:00
|
|
|
|
# define VL_ATTR_UNUSED __attribute__ ((unused))
|
2009-12-05 15:38:49 +00:00
|
|
|
|
# define VL_FUNC __func__
|
2006-08-26 11:35:28 +00:00
|
|
|
|
# define VL_LIKELY(x) __builtin_expect(!!(x), 1)
|
|
|
|
|
# define VL_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
2017-09-13 23:27:59 +00:00
|
|
|
|
# define VL_UNREACHABLE __builtin_unreachable();
|
2007-02-07 14:26:53 +00:00
|
|
|
|
# define VL_PREFETCH_RD(p) __builtin_prefetch((p),0)
|
|
|
|
|
# define VL_PREFETCH_RW(p) __builtin_prefetch((p),1)
|
2010-02-04 00:19:18 +00:00
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
|
# define VL_ATTR_ALIGNED(alignment)
|
|
|
|
|
# define VL_ATTR_ALWINLINE
|
|
|
|
|
# define VL_ATTR_NORETURN
|
|
|
|
|
# define VL_ATTR_PRINTF(fmtArgNum)
|
|
|
|
|
# define VL_ATTR_UNUSED
|
|
|
|
|
# define VL_FUNC __FUNCTION__
|
|
|
|
|
# define VL_LIKELY(x) (!!(x))
|
|
|
|
|
# define VL_UNLIKELY(x) (!!(x))
|
2017-09-13 23:27:59 +00:00
|
|
|
|
# define VL_UNREACHABLE
|
2010-02-04 00:19:18 +00:00
|
|
|
|
# define VL_PREFETCH_RD(p)
|
|
|
|
|
# define VL_PREFETCH_RW(p)
|
2006-08-26 11:35:28 +00:00
|
|
|
|
#else
|
|
|
|
|
# define VL_ATTR_ALIGNED(alignment) ///< Align structure to specified byte alignment
|
2010-02-04 00:19:18 +00:00
|
|
|
|
# define VL_ATTR_ALWINLINE ///< Inline, even when not optimizing
|
2006-08-26 11:35:28 +00:00
|
|
|
|
# define VL_ATTR_NORETURN ///< Function does not ever return
|
2010-02-04 00:19:18 +00:00
|
|
|
|
# define VL_ATTR_PRINTF(fmtArgNum) ///< Function with printf format checking
|
2006-08-26 11:35:28 +00:00
|
|
|
|
# define VL_ATTR_UNUSED ///< Function that may be never used
|
2009-12-05 15:38:49 +00:00
|
|
|
|
# define VL_FUNC "__func__" ///< Name of current function for error macros
|
2007-11-30 22:12:53 +00:00
|
|
|
|
# define VL_LIKELY(x) (!!(x)) ///< Boolean expression more often true than false
|
|
|
|
|
# define VL_UNLIKELY(x) (!!(x)) ///< Boolean expression more often false than true
|
2017-09-13 23:27:59 +00:00
|
|
|
|
# define VL_UNREACHABLE ///< Point that may never be reached
|
2007-02-07 14:26:53 +00:00
|
|
|
|
# define VL_PREFETCH_RD(p) ///< Prefetch data with read intent
|
|
|
|
|
# define VL_PREFETCH_RW(p) ///< Prefetch data with read/write intent
|
2006-08-26 11:35:28 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef VL_THREADED
|
|
|
|
|
# ifdef __GNUC__
|
2017-10-08 01:29:57 +00:00
|
|
|
|
# if (__cplusplus < 201103L) && !defined(VL_THREADED_NO_C11_WARNING)
|
|
|
|
|
# error "VL_THREADED support plans to move to C++-11 and later only; use newer --std to be ready"
|
|
|
|
|
# endif
|
2006-08-26 11:35:28 +00:00
|
|
|
|
# else
|
|
|
|
|
# error "Unsupported compiler for VL_THREADED: No thread-local declarator"
|
|
|
|
|
# endif
|
2017-10-08 01:29:57 +00:00
|
|
|
|
# define VL_THREAD_LOCAL thread_local ///< Use new C++ static local thread
|
2006-08-26 11:35:28 +00:00
|
|
|
|
#else
|
2017-10-08 01:29:57 +00:00
|
|
|
|
# define VL_THREAD_LOCAL ///< Use new C++ static local thread
|
2006-08-26 11:35:28 +00:00
|
|
|
|
#endif
|
2017-10-08 01:29:57 +00:00
|
|
|
|
#define VL_THREAD ///< Deprecated
|
|
|
|
|
#define VL_STATIC_OR_THREAD static ///< Deprecated
|
2006-08-26 11:35:28 +00:00
|
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
# define VL_ULL(c) (c##ui64) ///< Add appropriate suffix to 64-bit constant
|
|
|
|
|
#else
|
|
|
|
|
# define VL_ULL(c) (c##ULL) ///< Add appropriate suffix to 64-bit constant
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-10-31 19:22:26 +00:00
|
|
|
|
// This is not necessarily the same as #UL, depending on what the IData typedef is.
|
2017-10-07 19:01:19 +00:00
|
|
|
|
#define VL_UL(c) (static_cast<IData>(c##UL)) ///< Add appropriate suffix to 32-bit constant
|
2007-10-31 19:22:26 +00:00
|
|
|
|
|
2017-07-07 00:25:59 +00:00
|
|
|
|
#if defined(VL_CPPCHECK) || defined(__clang_analyzer__)
|
2015-10-04 17:16:35 +00:00
|
|
|
|
# define VL_DANGLING(v)
|
|
|
|
|
#else
|
|
|
|
|
# define VL_DANGLING(v) do { (v) = NULL; } while(0) ///< After e.g. delete, set variable to NULL to indicate must not use later
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-03-15 18:50:03 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
// C++-2011
|
|
|
|
|
|
|
|
|
|
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
|
|
|
|
# define VL_HAS_UNIQUE_PTR
|
2017-10-08 01:29:57 +00:00
|
|
|
|
# define VL_HAS_UNORDERED_MAP
|
2017-10-18 21:38:10 +00:00
|
|
|
|
# define VL_HAS_UNORDERED_SET
|
2017-10-08 01:29:57 +00:00
|
|
|
|
# define VL_UNIQUE_PTR std::unique_ptr
|
|
|
|
|
# define VL_UNORDERED_MAP std::unordered_map
|
2017-10-18 21:38:10 +00:00
|
|
|
|
# define VL_UNORDERED_SET std::unordered_set
|
2017-10-08 01:29:57 +00:00
|
|
|
|
# define VL_INCLUDE_UNORDERED_MAP <unordered_map>
|
2017-10-18 21:38:10 +00:00
|
|
|
|
# define VL_INCLUDE_UNORDERED_SET <unordered_set>
|
2014-03-15 18:50:03 +00:00
|
|
|
|
#else
|
2017-10-08 01:29:57 +00:00
|
|
|
|
# define VL_UNIQUE_PTR std::auto_ptr
|
|
|
|
|
# define VL_UNORDERED_MAP std::map
|
2017-10-18 21:38:10 +00:00
|
|
|
|
# define VL_UNORDERED_SET std::set
|
2017-10-08 01:29:57 +00:00
|
|
|
|
# define VL_INCLUDE_UNORDERED_MAP <map>
|
2017-10-18 21:38:10 +00:00
|
|
|
|
# define VL_INCLUDE_UNORDERED_SET <set>
|
2014-03-15 18:50:03 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2014-11-27 15:52:38 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
// Optimization
|
|
|
|
|
|
|
|
|
|
#ifndef VL_INLINE_OPT
|
|
|
|
|
# define VL_INLINE_OPT ///< "inline" if compiling all objects in single compiler run
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-01-24 11:20:10 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
// Warning disabled
|
|
|
|
|
|
|
|
|
|
#ifndef VL_WARNINGS
|
|
|
|
|
# ifdef _MSC_VER
|
2010-01-25 01:53:24 +00:00
|
|
|
|
# pragma warning(disable:4099) // C4099: type name first seen using 'class' now seen using 'struct' (V3AstNode)
|
2010-01-24 11:20:10 +00:00
|
|
|
|
# pragma warning(disable:4100) // C4100: unreferenced formal parameter (L4)
|
|
|
|
|
# pragma warning(disable:4127) // C4127: conditional expression is constant (L4)
|
|
|
|
|
# pragma warning(disable:4146) // C4146: unary minus operator applied to unsigned type, result still unsigned
|
|
|
|
|
# pragma warning(disable:4189) // C4189: local variable is initialized but not referenced (L4)
|
|
|
|
|
# pragma warning(disable:4244) // C4244: conversion from 'uint64_t' to 'uint_32_t', possible loss of data
|
|
|
|
|
# pragma warning(disable:4245) // C4245: conversion from 'int' to 'unsigned', signed/unsigned mismatch
|
|
|
|
|
# pragma warning(disable:4996) // C4996: sscanf/fopen/etc may be unsafe
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
// Basic integer types
|
|
|
|
|
|
|
|
|
|
#ifdef VL_UINTS_DEFINED
|
|
|
|
|
#elif defined(__CYGWIN__)
|
2010-01-16 16:53:08 +00:00
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
|
# include <stdint.h>
|
2006-09-19 15:27:15 +00:00
|
|
|
|
typedef unsigned char uint8_t; ///< 8-bit unsigned type (backward compatibility)
|
|
|
|
|
typedef unsigned short int uint16_t; ///< 16-bit unsigned type (backward compatibility)
|
|
|
|
|
typedef unsigned char vluint8_t; ///< 8-bit unsigned type
|
|
|
|
|
typedef unsigned short int vluint16_t; ///< 16-bit unsigned type
|
2015-05-08 00:41:53 +00:00
|
|
|
|
# if defined(__uint32_t_defined) || defined(___int32_t_defined) // Newer Cygwin uint32_t in stdint.h as an unsigned int
|
2010-01-16 16:53:08 +00:00
|
|
|
|
typedef int32_t vlsint32_t; ///< 32-bit signed type
|
|
|
|
|
typedef uint32_t vluint32_t; ///< 32-bit unsigned type
|
|
|
|
|
# else // Older Cygwin has long==uint32_t
|
|
|
|
|
typedef unsigned long uint32_t; ///< 32-bit unsigned type (backward compatibility)
|
|
|
|
|
typedef long vlsint32_t; ///< 32-bit signed type
|
|
|
|
|
typedef unsigned long vluint32_t; ///< 32-bit unsigned type
|
|
|
|
|
# endif
|
2010-04-10 01:51:15 +00:00
|
|
|
|
# if defined(__WORDSIZE) && (__WORDSIZE == 64)
|
|
|
|
|
typedef long vlsint64_t; ///< 64-bit signed type
|
|
|
|
|
typedef unsigned long vluint64_t; ///< 64-bit unsigned type
|
|
|
|
|
# else
|
2008-06-10 01:25:10 +00:00
|
|
|
|
typedef long long vlsint64_t; ///< 64-bit signed type
|
2010-04-10 01:51:15 +00:00
|
|
|
|
typedef unsigned long long vluint64_t; ///< 64-bit unsigned type
|
|
|
|
|
# endif
|
2010-01-16 16:53:08 +00:00
|
|
|
|
|
2008-11-05 15:52:23 +00:00
|
|
|
|
#elif defined(_WIN32) && defined(_MSC_VER)
|
2010-01-16 16:53:08 +00:00
|
|
|
|
|
2010-01-24 11:20:10 +00:00
|
|
|
|
typedef unsigned __int8 uint8_t; ///< 8-bit unsigned type (backward compatibility)
|
|
|
|
|
typedef unsigned __int16 uint16_t; ///< 16-bit unsigned type (backward compatibility)
|
|
|
|
|
typedef unsigned __int32 uint32_t; ///< 32-bit unsigned type (backward compatibility)
|
|
|
|
|
typedef unsigned __int8 vluint8_t; ///< 8-bit unsigned type
|
|
|
|
|
typedef unsigned __int16 vluint16_t; ///< 16-bit unsigned type
|
|
|
|
|
typedef signed __int32 vlsint32_t; ///< 32-bit signed type
|
|
|
|
|
typedef unsigned __int32 vluint32_t; ///< 32-bit unsigned type
|
|
|
|
|
typedef signed __int64 vlsint64_t; ///< 64-bit signed type
|
|
|
|
|
typedef unsigned __int64 vluint64_t; ///< 64-bit unsigned type
|
2010-01-16 16:53:08 +00:00
|
|
|
|
|
2010-04-10 10:46:24 +00:00
|
|
|
|
# ifndef _SSIZE_T_DEFINED
|
|
|
|
|
# ifdef _WIN64
|
|
|
|
|
typedef signed __int64 ssize_t; ///< signed size_t; returned from read()
|
|
|
|
|
# else
|
|
|
|
|
typedef signed __int32 ssize_t; ///< signed size_t; returned from read()
|
|
|
|
|
# endif
|
|
|
|
|
# endif
|
|
|
|
|
|
2006-09-19 15:27:15 +00:00
|
|
|
|
#else // Linux or compliant Unix flavors, -m64
|
2010-01-16 16:53:08 +00:00
|
|
|
|
|
2006-09-25 15:58:17 +00:00
|
|
|
|
# include <stdint.h> // Linux and most flavors
|
2015-03-16 14:08:59 +00:00
|
|
|
|
# include <unistd.h> // Linux ssize_t
|
2006-09-25 15:58:17 +00:00
|
|
|
|
# include <inttypes.h> // Solaris
|
2006-09-19 15:27:15 +00:00
|
|
|
|
typedef uint8_t vluint8_t; ///< 32-bit unsigned type
|
|
|
|
|
typedef uint16_t vluint16_t; ///< 32-bit unsigned type
|
2008-06-10 01:25:10 +00:00
|
|
|
|
typedef int vlsint32_t; ///< 32-bit signed type
|
2006-09-19 15:27:15 +00:00
|
|
|
|
typedef uint32_t vluint32_t; ///< 32-bit signed type
|
2010-04-10 01:51:15 +00:00
|
|
|
|
# if defined(__WORDSIZE) && (__WORDSIZE == 64)
|
|
|
|
|
typedef long vlsint64_t; ///< 64-bit signed type
|
|
|
|
|
typedef unsigned long vluint64_t; ///< 64-bit unsigned type
|
|
|
|
|
# else
|
2008-06-10 01:25:10 +00:00
|
|
|
|
typedef long long vlsint64_t; ///< 64-bit signed type
|
2006-09-19 15:27:15 +00:00
|
|
|
|
typedef unsigned long long vluint64_t; ///< 64-bit unsigned type
|
2010-04-10 01:51:15 +00:00
|
|
|
|
# endif
|
2006-08-26 11:35:28 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2010-02-01 14:28:53 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
// Printing printf/scanf formats
|
|
|
|
|
// Alas cinttypes isn't that standard yet
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
# define VL_PRI64 "I64"
|
|
|
|
|
#else // Linux or compliant Unix flavors
|
2010-04-10 01:51:15 +00:00
|
|
|
|
# if defined(__WORDSIZE) && (__WORDSIZE == 64)
|
|
|
|
|
# define VL_PRI64 "l"
|
|
|
|
|
# else
|
|
|
|
|
# define VL_PRI64 "ll"
|
|
|
|
|
# endif
|
2010-02-01 14:28:53 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2015-06-16 11:13:45 +00:00
|
|
|
|
#if defined(_WIN32) && defined(_MSC_VER)
|
2015-06-22 01:01:02 +00:00
|
|
|
|
# if (_MSC_VER < 1900)
|
|
|
|
|
# define VL_SNPRINTF _snprintf
|
|
|
|
|
# else
|
|
|
|
|
# define VL_SNPRINTF snprintf
|
|
|
|
|
# endif
|
|
|
|
|
# define VL_VSNPRINTF vsnprintf
|
2015-06-04 23:37:03 +00:00
|
|
|
|
#else
|
2015-06-16 11:13:45 +00:00
|
|
|
|
# define VL_SNPRINTF snprintf
|
2015-06-04 23:37:03 +00:00
|
|
|
|
# define VL_VSNPRINTF vsnprintf
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-11-29 13:28:48 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
// File system functions
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
# define VL_DEV_NULL "nul"
|
|
|
|
|
#else // Linux or compliant Unix flavors
|
|
|
|
|
# define VL_DEV_NULL "/dev/null"
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
// Integer size macros
|
|
|
|
|
|
2008-06-28 00:04:20 +00:00
|
|
|
|
#define VL_BYTESIZE 8 ///< Bits in a byte
|
2008-07-01 18:15:10 +00:00
|
|
|
|
#define VL_SHORTSIZE 16 ///< Bits in a short
|
2006-08-26 11:35:28 +00:00
|
|
|
|
#define VL_WORDSIZE 32 ///< Bits in a word
|
|
|
|
|
#define VL_QUADSIZE 64 ///< Bits in a quadword
|
|
|
|
|
#define VL_WORDSIZE_LOG2 5 ///< log2(VL_WORDSIZE)
|
|
|
|
|
|
2008-06-28 00:04:20 +00:00
|
|
|
|
/// Bytes this number of bits needs (1 bit=1 byte)
|
|
|
|
|
#define VL_BYTES_I(nbits) (((nbits)+(VL_BYTESIZE-1))/VL_BYTESIZE)
|
2006-08-26 11:35:28 +00:00
|
|
|
|
/// Words this number of bits needs (1 bit=1 word)
|
|
|
|
|
#define VL_WORDS_I(nbits) (((nbits)+(VL_WORDSIZE-1))/VL_WORDSIZE)
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Verilated function size macros
|
|
|
|
|
|
|
|
|
|
#define VL_MULS_MAX_WORDS 16 ///< Max size in words of MULS operation
|
|
|
|
|
#define VL_TO_STRING_MAX_WORDS 64 ///< Max size in words of String conversion operation
|
|
|
|
|
|
|
|
|
|
//=========================================================================
|
|
|
|
|
// Base macros
|
|
|
|
|
|
|
|
|
|
#define VL_SIZEBITS_I (VL_WORDSIZE-1) ///< Bit mask for bits in a word
|
|
|
|
|
#define VL_SIZEBITS_Q (VL_QUADSIZE-1) ///< Bit mask for bits in a quad
|
|
|
|
|
|
|
|
|
|
/// Mask for words with 1's where relevant bits are (0=all bits)
|
|
|
|
|
#define VL_MASK_I(nbits) (((nbits) & VL_SIZEBITS_I) \
|
|
|
|
|
? ((1U << ((nbits) & VL_SIZEBITS_I) )-1) : ~0)
|
|
|
|
|
/// Mask for quads with 1's where relevant bits are (0=all bits)
|
|
|
|
|
#define VL_MASK_Q(nbits) (((nbits) & VL_SIZEBITS_Q) \
|
|
|
|
|
? ((VL_ULL(1) << ((nbits) & VL_SIZEBITS_Q) )-VL_ULL(1)) : VL_ULL(~0))
|
|
|
|
|
#define VL_BITWORD_I(bit) ((bit)/VL_WORDSIZE) ///< Word number for a wide quantity
|
|
|
|
|
#define VL_BITBIT_I(bit) ((bit)&VL_SIZEBITS_I) ///< Bit number for a bit in a long
|
|
|
|
|
#define VL_BITBIT_Q(bit) ((bit)&VL_SIZEBITS_Q) ///< Bit number for a bit in a quad
|
|
|
|
|
|
2011-09-21 13:08:05 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
// Floating point
|
|
|
|
|
// #defines, to avoid requiring math.h on all compile runs
|
|
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
# define VL_TRUNC(n) (((n)<0) ? ceil((n)) : floor((n)))
|
|
|
|
|
# define VL_ROUND(n) (((n)<0) ? ceil((n)-0.5) : floor((n)+0.5))
|
|
|
|
|
#else
|
|
|
|
|
# define VL_TRUNC(n) trunc(n)
|
|
|
|
|
# define VL_ROUND(n) round(n)
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//=========================================================================
|
|
|
|
|
|
|
|
|
|
#endif /*guard*/
|