📄 vcl_limits.cxx
字号:
// This is vcl/emulation/vcl_limits.cxx
#ifdef VCL_NEEDS_PRAGMA_INTERFACE
#pragma implementation
#endif
//
// numeric_limits for STL versions that don't have them.
// Author: Andrew W. Fitzgibbon, Oxford RRG
// Created: 28 Aug 96
//
//-----------------------------------------------------------------------------
#include <vcl_compiler.h>
#if !VCL_CXX_HAS_HEADER_LIMITS || !VCL_USE_NATIVE_STL || (!VCL_NUMERIC_LIMITS_HAS_INFINITY && VCL_PROCESSOR_HAS_INFINITY)
#include "vcl_limits.h"
#include <vxl_config.h> // for VXL_BIG_ENDIAN
// ----------------------------------------------------------------------
// Constants for int
#if !VCL_STATIC_CONST_INIT_INT_NO_DEFN
const bool vcl_numeric_limits<int>::is_specialized VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<int>::digits VCL_STATIC_CONST_INIT_INT_DEFN(31);
const int vcl_numeric_limits<int>::digits10 VCL_STATIC_CONST_INIT_INT_DEFN(9);
const bool vcl_numeric_limits<int>::is_signed VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<int>::is_integer VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<int>::is_exact VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<int>::radix VCL_STATIC_CONST_INIT_INT_DEFN(2);
const int vcl_numeric_limits<int>::min_exponent VCL_STATIC_CONST_INIT_INT_DEFN(-31);
const int vcl_numeric_limits<int>::min_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(-9);
const int vcl_numeric_limits<int>::max_exponent VCL_STATIC_CONST_INIT_INT_DEFN(31);
const int vcl_numeric_limits<int>::max_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(9);
const bool vcl_numeric_limits<int>::has_infinity VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<int>::has_quiet_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<int>::has_signaling_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<int>::has_denorm VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<int>::is_iec559 VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<int>::is_bounded VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<int>::is_modulo VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<int>::traps VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<int>::tinyness_before VCL_STATIC_CONST_INIT_INT_DEFN(false);
const vcl_float_round_style vcl_numeric_limits<int>::round_style VCL_STATIC_CONST_INIT_INT_DEFN(vcl_round_toward_zero);
#endif
// ----------------------------------------------------------------------
// Constants for long
#if !VCL_STATIC_CONST_INIT_INT_NO_DEFN
const bool vcl_numeric_limits<long>::is_specialized VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<long>::digits VCL_STATIC_CONST_INIT_INT_DEFN(31);
const int vcl_numeric_limits<long>::digits10 VCL_STATIC_CONST_INIT_INT_DEFN(9);
const bool vcl_numeric_limits<long>::is_signed VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<long>::is_integer VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<long>::is_exact VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<long>::radix VCL_STATIC_CONST_INIT_INT_DEFN(2);
const int vcl_numeric_limits<long>::min_exponent VCL_STATIC_CONST_INIT_INT_DEFN(-31);
const int vcl_numeric_limits<long>::min_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(-9);
const int vcl_numeric_limits<long>::max_exponent VCL_STATIC_CONST_INIT_INT_DEFN(31);
const int vcl_numeric_limits<long>::max_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(9);
const bool vcl_numeric_limits<long>::has_infinity VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<long>::has_quiet_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<long>::has_signaling_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<long>::has_denorm VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<long>::is_iec559 VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<long>::is_bounded VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<long>::is_modulo VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<long>::traps VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<long>::tinyness_before VCL_STATIC_CONST_INIT_INT_DEFN(false);
const vcl_float_round_style vcl_numeric_limits<long>::round_style VCL_STATIC_CONST_INIT_INT_DEFN(vcl_round_toward_zero);
#endif
// ----------------------------------------------------------------------
// Constants for unsigned long
#if !VCL_STATIC_CONST_INIT_INT_NO_DEFN
const bool vcl_numeric_limits<unsigned long>::is_specialized VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<unsigned long>::digits VCL_STATIC_CONST_INIT_INT_DEFN(sizeof(unsigned long) * 8 );
const int vcl_numeric_limits<unsigned long>::digits10 VCL_STATIC_CONST_INIT_INT_DEFN( (digits * 301) / 1000 );
const bool vcl_numeric_limits<unsigned long>::is_signed VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned long>::is_integer VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<unsigned long>::is_exact VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<unsigned long>::radix VCL_STATIC_CONST_INIT_INT_DEFN(2);
const int vcl_numeric_limits<unsigned long>::min_exponent VCL_STATIC_CONST_INIT_INT_DEFN(-31);
const int vcl_numeric_limits<unsigned long>::min_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(-9);
const int vcl_numeric_limits<unsigned long>::max_exponent VCL_STATIC_CONST_INIT_INT_DEFN(31);
const int vcl_numeric_limits<unsigned long>::max_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(9);
const bool vcl_numeric_limits<unsigned long>::has_infinity VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned long>::has_quiet_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned long>::has_signaling_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned long>::has_denorm VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned long>::is_iec559 VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned long>::is_bounded VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<unsigned long>::is_modulo VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<unsigned long>::traps VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned long>::tinyness_before VCL_STATIC_CONST_INIT_INT_DEFN(false);
const vcl_float_round_style vcl_numeric_limits<unsigned long>::round_style VCL_STATIC_CONST_INIT_INT_DEFN(vcl_round_toward_zero);
#endif
// ----------------------------------------------------------------------
// Constants for unsigned short
#if !VCL_STATIC_CONST_INIT_INT_NO_DEFN
const bool vcl_numeric_limits<unsigned short>::is_specialized VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<unsigned short>::digits VCL_STATIC_CONST_INIT_INT_DEFN(sizeof(unsigned short) * 8 );
const int vcl_numeric_limits<unsigned short>::digits10 VCL_STATIC_CONST_INIT_INT_DEFN( (digits * 301) / 1000 );
const bool vcl_numeric_limits<unsigned short>::is_signed VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned short>::is_integer VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<unsigned short>::is_exact VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<unsigned short>::radix VCL_STATIC_CONST_INIT_INT_DEFN(2);
const int vcl_numeric_limits<unsigned short>::min_exponent VCL_STATIC_CONST_INIT_INT_DEFN(-31);
const int vcl_numeric_limits<unsigned short>::min_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(-9);
const int vcl_numeric_limits<unsigned short>::max_exponent VCL_STATIC_CONST_INIT_INT_DEFN(31);
const int vcl_numeric_limits<unsigned short>::max_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(9);
const bool vcl_numeric_limits<unsigned short>::has_infinity VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned short>::has_quiet_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned short>::has_signaling_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned short>::has_denorm VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned short>::is_iec559 VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned short>::is_bounded VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<unsigned short>::is_modulo VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<unsigned short>::traps VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned short>::tinyness_before VCL_STATIC_CONST_INIT_INT_DEFN(false);
const vcl_float_round_style vcl_numeric_limits<unsigned short>::round_style VCL_STATIC_CONST_INIT_INT_DEFN(vcl_round_toward_zero);
#endif
// ----------------------------------------------------------------------
// Constants for short
#if !VCL_STATIC_CONST_INIT_INT_NO_DEFN
const bool vcl_numeric_limits<short>::is_specialized VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<short>::digits VCL_STATIC_CONST_INIT_INT_DEFN(15);
const int vcl_numeric_limits<short>::digits10 VCL_STATIC_CONST_INIT_INT_DEFN(5);
const bool vcl_numeric_limits<short>::is_signed VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<short>::is_integer VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<short>::is_exact VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<short>::radix VCL_STATIC_CONST_INIT_INT_DEFN(2);
const int vcl_numeric_limits<short>::min_exponent VCL_STATIC_CONST_INIT_INT_DEFN(-15);
const int vcl_numeric_limits<short>::min_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(-5);
const int vcl_numeric_limits<short>::max_exponent VCL_STATIC_CONST_INIT_INT_DEFN(15);
const int vcl_numeric_limits<short>::max_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(5);
const bool vcl_numeric_limits<short>::has_infinity VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<short>::has_quiet_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<short>::has_signaling_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<short>::has_denorm VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<short>::is_iec559 VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<short>::is_bounded VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<short>::is_modulo VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<short>::traps VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<short>::tinyness_before VCL_STATIC_CONST_INIT_INT_DEFN(false);
const vcl_float_round_style vcl_numeric_limits<short>::round_style VCL_STATIC_CONST_INIT_INT_DEFN(vcl_round_toward_zero);
#endif
// ----------------------------------------------------------------------
// Constants for signed char
#if !VCL_STATIC_CONST_INIT_INT_NO_DEFN
const bool vcl_numeric_limits<signed char>::is_specialized VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<signed char>::digits VCL_STATIC_CONST_INIT_INT_DEFN(7);
const int vcl_numeric_limits<signed char>::digits10 VCL_STATIC_CONST_INIT_INT_DEFN(3);
const bool vcl_numeric_limits<signed char>::is_signed VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<signed char>::is_integer VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<signed char>::is_exact VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<signed char>::radix VCL_STATIC_CONST_INIT_INT_DEFN(2);
const int vcl_numeric_limits<signed char>::min_exponent VCL_STATIC_CONST_INIT_INT_DEFN(-7);
const int vcl_numeric_limits<signed char>::min_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(-3);
const int vcl_numeric_limits<signed char>::max_exponent VCL_STATIC_CONST_INIT_INT_DEFN(7);
const int vcl_numeric_limits<signed char>::max_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(3);
const bool vcl_numeric_limits<signed char>::has_infinity VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<signed char>::has_quiet_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<signed char>::has_signaling_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<signed char>::has_denorm VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<signed char>::is_iec559 VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<signed char>::is_bounded VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<signed char>::is_modulo VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<signed char>::traps VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<signed char>::tinyness_before VCL_STATIC_CONST_INIT_INT_DEFN(false);
const vcl_float_round_style vcl_numeric_limits<signed char>::round_style VCL_STATIC_CONST_INIT_INT_DEFN(vcl_round_toward_zero);
#endif
// ----------------------------------------------------------------------
// Constants for unsigned char
#if !VCL_STATIC_CONST_INIT_INT_NO_DEFN
const bool vcl_numeric_limits<unsigned char>::is_specialized VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<unsigned char>::digits VCL_STATIC_CONST_INIT_INT_DEFN(8);
const int vcl_numeric_limits<unsigned char>::digits10 VCL_STATIC_CONST_INIT_INT_DEFN(3);
const bool vcl_numeric_limits<unsigned char>::is_signed VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned char>::is_integer VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<unsigned char>::is_exact VCL_STATIC_CONST_INIT_INT_DEFN(true);
const int vcl_numeric_limits<unsigned char>::radix VCL_STATIC_CONST_INIT_INT_DEFN(2);
const int vcl_numeric_limits<unsigned char>::min_exponent VCL_STATIC_CONST_INIT_INT_DEFN(-8);
const int vcl_numeric_limits<unsigned char>::min_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(-3);
const int vcl_numeric_limits<unsigned char>::max_exponent VCL_STATIC_CONST_INIT_INT_DEFN(8);
const int vcl_numeric_limits<unsigned char>::max_exponent10 VCL_STATIC_CONST_INIT_INT_DEFN(3);
const bool vcl_numeric_limits<unsigned char>::has_infinity VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned char>::has_quiet_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned char>::has_signaling_NaN VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned char>::has_denorm VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned char>::is_iec559 VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned char>::is_bounded VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<unsigned char>::is_modulo VCL_STATIC_CONST_INIT_INT_DEFN(true);
const bool vcl_numeric_limits<unsigned char>::traps VCL_STATIC_CONST_INIT_INT_DEFN(false);
const bool vcl_numeric_limits<unsigned char>::tinyness_before VCL_STATIC_CONST_INIT_INT_DEFN(false);
const vcl_float_round_style vcl_numeric_limits<unsigned char>::round_style VCL_STATIC_CONST_INIT_INT_DEFN(vcl_round_toward_zero);
#endif
// ----------------------------------------------------------------------
// Constants and functions for double
union vcl_numeric_limits_double_nan {
double nan;
unsigned char x[8];
vcl_numeric_limits_double_nan() {
#if VXL_BIG_ENDIAN
x[0] = 0x7f;
x[1] = x[2] = x[3] = x[4] = x[5] = x[6] = x[7] = 0xff;
#else
x[7] = 0x7f;
x[0] = x[1] = x[2] = x[3] = x[4] = x[5] = x[6] = 0xff;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -