You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
348 lines
11 KiB
348 lines
11 KiB
//----------------------------------------------------------------------------
|
|
//
|
|
// d3dflt.cpp
|
|
//
|
|
// Supporting data and routines for general FP header.
|
|
//
|
|
// Copyright (C) Microsoft Corporation, 1997.
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#include "pch.cpp"
|
|
#pragma hdrstop
|
|
|
|
#ifdef _X86_
|
|
|
|
FLOAT g_fE = FLOAT_E;
|
|
FLOAT g_fZero = 0.0f;
|
|
FLOAT g_fNearZero = FLOAT_NEARZERO;
|
|
FLOAT g_fHalf = 0.5f;
|
|
FLOAT g_fp95 = 0.95f;
|
|
FLOAT g_fOne = 1.0f;
|
|
FLOAT g_fOneMinusEps = 1.0f - FLT_EPSILON;
|
|
FLOAT g_fExpScale = FLOAT_EXPSCALE;
|
|
FLOAT g_fOoExpScale = (FLOAT)(1.0 / (double)FLOAT_EXPSCALE);
|
|
FLOAT g_f255oTwoPow15 = (FLOAT)(255.0 / (double)CONST_TWOPOW15);
|
|
FLOAT g_fOo255 = (FLOAT)(1.0 / 255.0);
|
|
FLOAT g_fOo256 = (FLOAT)(1.0 / 256.0);
|
|
FLOAT g_fTwoPow7 = FLOAT_TWOPOW7;
|
|
FLOAT g_fTwoPow8 = FLOAT_TWOPOW8;
|
|
FLOAT g_fTwoPow11 = FLOAT_TWOPOW11;
|
|
FLOAT g_fTwoPow15 = FLOAT_TWOPOW15;
|
|
FLOAT g_fOoTwoPow15 = (FLOAT)(1.0 / (double)CONST_TWOPOW15);
|
|
FLOAT g_fTwoPow16 = FLOAT_TWOPOW16;
|
|
FLOAT g_fOoTwoPow16 = (FLOAT)(1.0 / (double)CONST_TWOPOW16);
|
|
FLOAT g_fTwoPow20 = FLOAT_TWOPOW20;
|
|
FLOAT g_fOoTwoPow20 = (FLOAT)(1.0 / (double)CONST_TWOPOW20);
|
|
FLOAT g_fTwoPow27 = FLOAT_TWOPOW27;
|
|
FLOAT g_fOoTwoPow27 = (FLOAT)(1.0 / (double)CONST_TWOPOW27);
|
|
FLOAT g_fTwoPow30 = FLOAT_TWOPOW30;
|
|
FLOAT g_fTwoPow31 = FLOAT_TWOPOW31;
|
|
FLOAT g_fNearTwoPow31 = FLOAT_NEARTWOPOW31;
|
|
FLOAT g_fOoTwoPow31 = (FLOAT)(1.0 / (double)CONST_TWOPOW31);
|
|
FLOAT g_fOoNearTwoPow31 = (FLOAT)(1.0 / (double)FLOAT_NEARTWOPOW31);
|
|
FLOAT g_fTwoPow32 = FLOAT_TWOPOW32;
|
|
FLOAT g_fNearTwoPow32 = FLOAT_NEARTWOPOW32;
|
|
FLOAT g_fTwoPow39 = FLOAT_TWOPOW39;
|
|
FLOAT g_fTwoPow47 = FLOAT_TWOPOW47;
|
|
|
|
#endif // _X86_
|
|
|
|
FLOAT g_fUInt8ToFloat[257] =
|
|
{
|
|
0.0f,
|
|
(FLOAT)(1.0 / 255.0),
|
|
(FLOAT)(2.0 / 255.0),
|
|
(FLOAT)(3.0 / 255.0),
|
|
(FLOAT)(4.0 / 255.0),
|
|
(FLOAT)(5.0 / 255.0),
|
|
(FLOAT)(6.0 / 255.0),
|
|
(FLOAT)(7.0 / 255.0),
|
|
(FLOAT)(8.0 / 255.0),
|
|
(FLOAT)(9.0 / 255.0),
|
|
(FLOAT)(10.0 / 255.0),
|
|
(FLOAT)(11.0 / 255.0),
|
|
(FLOAT)(12.0 / 255.0),
|
|
(FLOAT)(13.0 / 255.0),
|
|
(FLOAT)(14.0 / 255.0),
|
|
(FLOAT)(15.0 / 255.0),
|
|
(FLOAT)(16.0 / 255.0),
|
|
(FLOAT)(17.0 / 255.0),
|
|
(FLOAT)(18.0 / 255.0),
|
|
(FLOAT)(19.0 / 255.0),
|
|
(FLOAT)(20.0 / 255.0),
|
|
(FLOAT)(21.0 / 255.0),
|
|
(FLOAT)(22.0 / 255.0),
|
|
(FLOAT)(23.0 / 255.0),
|
|
(FLOAT)(24.0 / 255.0),
|
|
(FLOAT)(25.0 / 255.0),
|
|
(FLOAT)(26.0 / 255.0),
|
|
(FLOAT)(27.0 / 255.0),
|
|
(FLOAT)(28.0 / 255.0),
|
|
(FLOAT)(29.0 / 255.0),
|
|
(FLOAT)(30.0 / 255.0),
|
|
(FLOAT)(31.0 / 255.0),
|
|
(FLOAT)(32.0 / 255.0),
|
|
(FLOAT)(33.0 / 255.0),
|
|
(FLOAT)(34.0 / 255.0),
|
|
(FLOAT)(35.0 / 255.0),
|
|
(FLOAT)(36.0 / 255.0),
|
|
(FLOAT)(37.0 / 255.0),
|
|
(FLOAT)(38.0 / 255.0),
|
|
(FLOAT)(39.0 / 255.0),
|
|
(FLOAT)(40.0 / 255.0),
|
|
(FLOAT)(41.0 / 255.0),
|
|
(FLOAT)(42.0 / 255.0),
|
|
(FLOAT)(43.0 / 255.0),
|
|
(FLOAT)(44.0 / 255.0),
|
|
(FLOAT)(45.0 / 255.0),
|
|
(FLOAT)(46.0 / 255.0),
|
|
(FLOAT)(47.0 / 255.0),
|
|
(FLOAT)(48.0 / 255.0),
|
|
(FLOAT)(49.0 / 255.0),
|
|
(FLOAT)(50.0 / 255.0),
|
|
(FLOAT)(51.0 / 255.0),
|
|
(FLOAT)(52.0 / 255.0),
|
|
(FLOAT)(53.0 / 255.0),
|
|
(FLOAT)(54.0 / 255.0),
|
|
(FLOAT)(55.0 / 255.0),
|
|
(FLOAT)(56.0 / 255.0),
|
|
(FLOAT)(57.0 / 255.0),
|
|
(FLOAT)(58.0 / 255.0),
|
|
(FLOAT)(59.0 / 255.0),
|
|
(FLOAT)(60.0 / 255.0),
|
|
(FLOAT)(61.0 / 255.0),
|
|
(FLOAT)(62.0 / 255.0),
|
|
(FLOAT)(63.0 / 255.0),
|
|
(FLOAT)(64.0 / 255.0),
|
|
(FLOAT)(65.0 / 255.0),
|
|
(FLOAT)(66.0 / 255.0),
|
|
(FLOAT)(67.0 / 255.0),
|
|
(FLOAT)(68.0 / 255.0),
|
|
(FLOAT)(69.0 / 255.0),
|
|
(FLOAT)(70.0 / 255.0),
|
|
(FLOAT)(71.0 / 255.0),
|
|
(FLOAT)(72.0 / 255.0),
|
|
(FLOAT)(73.0 / 255.0),
|
|
(FLOAT)(74.0 / 255.0),
|
|
(FLOAT)(75.0 / 255.0),
|
|
(FLOAT)(76.0 / 255.0),
|
|
(FLOAT)(77.0 / 255.0),
|
|
(FLOAT)(78.0 / 255.0),
|
|
(FLOAT)(79.0 / 255.0),
|
|
(FLOAT)(80.0 / 255.0),
|
|
(FLOAT)(81.0 / 255.0),
|
|
(FLOAT)(82.0 / 255.0),
|
|
(FLOAT)(83.0 / 255.0),
|
|
(FLOAT)(84.0 / 255.0),
|
|
(FLOAT)(85.0 / 255.0),
|
|
(FLOAT)(86.0 / 255.0),
|
|
(FLOAT)(87.0 / 255.0),
|
|
(FLOAT)(88.0 / 255.0),
|
|
(FLOAT)(89.0 / 255.0),
|
|
(FLOAT)(90.0 / 255.0),
|
|
(FLOAT)(91.0 / 255.0),
|
|
(FLOAT)(92.0 / 255.0),
|
|
(FLOAT)(93.0 / 255.0),
|
|
(FLOAT)(94.0 / 255.0),
|
|
(FLOAT)(95.0 / 255.0),
|
|
(FLOAT)(96.0 / 255.0),
|
|
(FLOAT)(97.0 / 255.0),
|
|
(FLOAT)(98.0 / 255.0),
|
|
(FLOAT)(99.0 / 255.0),
|
|
(FLOAT)(100.0 / 255.0),
|
|
(FLOAT)(101.0 / 255.0),
|
|
(FLOAT)(102.0 / 255.0),
|
|
(FLOAT)(103.0 / 255.0),
|
|
(FLOAT)(104.0 / 255.0),
|
|
(FLOAT)(105.0 / 255.0),
|
|
(FLOAT)(106.0 / 255.0),
|
|
(FLOAT)(107.0 / 255.0),
|
|
(FLOAT)(108.0 / 255.0),
|
|
(FLOAT)(109.0 / 255.0),
|
|
(FLOAT)(110.0 / 255.0),
|
|
(FLOAT)(111.0 / 255.0),
|
|
(FLOAT)(112.0 / 255.0),
|
|
(FLOAT)(113.0 / 255.0),
|
|
(FLOAT)(114.0 / 255.0),
|
|
(FLOAT)(115.0 / 255.0),
|
|
(FLOAT)(116.0 / 255.0),
|
|
(FLOAT)(117.0 / 255.0),
|
|
(FLOAT)(118.0 / 255.0),
|
|
(FLOAT)(119.0 / 255.0),
|
|
(FLOAT)(120.0 / 255.0),
|
|
(FLOAT)(121.0 / 255.0),
|
|
(FLOAT)(122.0 / 255.0),
|
|
(FLOAT)(123.0 / 255.0),
|
|
(FLOAT)(124.0 / 255.0),
|
|
(FLOAT)(125.0 / 255.0),
|
|
(FLOAT)(126.0 / 255.0),
|
|
(FLOAT)(127.0 / 255.0),
|
|
(FLOAT)(128.0 / 255.0),
|
|
(FLOAT)(129.0 / 255.0),
|
|
(FLOAT)(130.0 / 255.0),
|
|
(FLOAT)(131.0 / 255.0),
|
|
(FLOAT)(132.0 / 255.0),
|
|
(FLOAT)(133.0 / 255.0),
|
|
(FLOAT)(134.0 / 255.0),
|
|
(FLOAT)(135.0 / 255.0),
|
|
(FLOAT)(136.0 / 255.0),
|
|
(FLOAT)(137.0 / 255.0),
|
|
(FLOAT)(138.0 / 255.0),
|
|
(FLOAT)(139.0 / 255.0),
|
|
(FLOAT)(140.0 / 255.0),
|
|
(FLOAT)(141.0 / 255.0),
|
|
(FLOAT)(142.0 / 255.0),
|
|
(FLOAT)(143.0 / 255.0),
|
|
(FLOAT)(144.0 / 255.0),
|
|
(FLOAT)(145.0 / 255.0),
|
|
(FLOAT)(146.0 / 255.0),
|
|
(FLOAT)(147.0 / 255.0),
|
|
(FLOAT)(148.0 / 255.0),
|
|
(FLOAT)(149.0 / 255.0),
|
|
(FLOAT)(150.0 / 255.0),
|
|
(FLOAT)(151.0 / 255.0),
|
|
(FLOAT)(152.0 / 255.0),
|
|
(FLOAT)(153.0 / 255.0),
|
|
(FLOAT)(154.0 / 255.0),
|
|
(FLOAT)(155.0 / 255.0),
|
|
(FLOAT)(156.0 / 255.0),
|
|
(FLOAT)(157.0 / 255.0),
|
|
(FLOAT)(158.0 / 255.0),
|
|
(FLOAT)(159.0 / 255.0),
|
|
(FLOAT)(160.0 / 255.0),
|
|
(FLOAT)(161.0 / 255.0),
|
|
(FLOAT)(162.0 / 255.0),
|
|
(FLOAT)(163.0 / 255.0),
|
|
(FLOAT)(164.0 / 255.0),
|
|
(FLOAT)(165.0 / 255.0),
|
|
(FLOAT)(166.0 / 255.0),
|
|
(FLOAT)(167.0 / 255.0),
|
|
(FLOAT)(168.0 / 255.0),
|
|
(FLOAT)(169.0 / 255.0),
|
|
(FLOAT)(170.0 / 255.0),
|
|
(FLOAT)(171.0 / 255.0),
|
|
(FLOAT)(172.0 / 255.0),
|
|
(FLOAT)(173.0 / 255.0),
|
|
(FLOAT)(174.0 / 255.0),
|
|
(FLOAT)(175.0 / 255.0),
|
|
(FLOAT)(176.0 / 255.0),
|
|
(FLOAT)(177.0 / 255.0),
|
|
(FLOAT)(178.0 / 255.0),
|
|
(FLOAT)(179.0 / 255.0),
|
|
(FLOAT)(180.0 / 255.0),
|
|
(FLOAT)(181.0 / 255.0),
|
|
(FLOAT)(182.0 / 255.0),
|
|
(FLOAT)(183.0 / 255.0),
|
|
(FLOAT)(184.0 / 255.0),
|
|
(FLOAT)(185.0 / 255.0),
|
|
(FLOAT)(186.0 / 255.0),
|
|
(FLOAT)(187.0 / 255.0),
|
|
(FLOAT)(188.0 / 255.0),
|
|
(FLOAT)(189.0 / 255.0),
|
|
(FLOAT)(190.0 / 255.0),
|
|
(FLOAT)(191.0 / 255.0),
|
|
(FLOAT)(192.0 / 255.0),
|
|
(FLOAT)(193.0 / 255.0),
|
|
(FLOAT)(194.0 / 255.0),
|
|
(FLOAT)(195.0 / 255.0),
|
|
(FLOAT)(196.0 / 255.0),
|
|
(FLOAT)(197.0 / 255.0),
|
|
(FLOAT)(198.0 / 255.0),
|
|
(FLOAT)(199.0 / 255.0),
|
|
(FLOAT)(200.0 / 255.0),
|
|
(FLOAT)(201.0 / 255.0),
|
|
(FLOAT)(202.0 / 255.0),
|
|
(FLOAT)(203.0 / 255.0),
|
|
(FLOAT)(204.0 / 255.0),
|
|
(FLOAT)(205.0 / 255.0),
|
|
(FLOAT)(206.0 / 255.0),
|
|
(FLOAT)(207.0 / 255.0),
|
|
(FLOAT)(208.0 / 255.0),
|
|
(FLOAT)(209.0 / 255.0),
|
|
(FLOAT)(210.0 / 255.0),
|
|
(FLOAT)(211.0 / 255.0),
|
|
(FLOAT)(212.0 / 255.0),
|
|
(FLOAT)(213.0 / 255.0),
|
|
(FLOAT)(214.0 / 255.0),
|
|
(FLOAT)(215.0 / 255.0),
|
|
(FLOAT)(216.0 / 255.0),
|
|
(FLOAT)(217.0 / 255.0),
|
|
(FLOAT)(218.0 / 255.0),
|
|
(FLOAT)(219.0 / 255.0),
|
|
(FLOAT)(220.0 / 255.0),
|
|
(FLOAT)(221.0 / 255.0),
|
|
(FLOAT)(222.0 / 255.0),
|
|
(FLOAT)(223.0 / 255.0),
|
|
(FLOAT)(224.0 / 255.0),
|
|
(FLOAT)(225.0 / 255.0),
|
|
(FLOAT)(226.0 / 255.0),
|
|
(FLOAT)(227.0 / 255.0),
|
|
(FLOAT)(228.0 / 255.0),
|
|
(FLOAT)(229.0 / 255.0),
|
|
(FLOAT)(230.0 / 255.0),
|
|
(FLOAT)(231.0 / 255.0),
|
|
(FLOAT)(232.0 / 255.0),
|
|
(FLOAT)(233.0 / 255.0),
|
|
(FLOAT)(234.0 / 255.0),
|
|
(FLOAT)(235.0 / 255.0),
|
|
(FLOAT)(236.0 / 255.0),
|
|
(FLOAT)(237.0 / 255.0),
|
|
(FLOAT)(238.0 / 255.0),
|
|
(FLOAT)(239.0 / 255.0),
|
|
(FLOAT)(240.0 / 255.0),
|
|
(FLOAT)(241.0 / 255.0),
|
|
(FLOAT)(242.0 / 255.0),
|
|
(FLOAT)(243.0 / 255.0),
|
|
(FLOAT)(244.0 / 255.0),
|
|
(FLOAT)(245.0 / 255.0),
|
|
(FLOAT)(246.0 / 255.0),
|
|
(FLOAT)(247.0 / 255.0),
|
|
(FLOAT)(248.0 / 255.0),
|
|
(FLOAT)(249.0 / 255.0),
|
|
(FLOAT)(250.0 / 255.0),
|
|
(FLOAT)(251.0 / 255.0),
|
|
(FLOAT)(252.0 / 255.0),
|
|
(FLOAT)(253.0 / 255.0),
|
|
(FLOAT)(254.0 / 255.0),
|
|
1.0f,
|
|
// Extra entry to allow for overflow.
|
|
1.0f,
|
|
};
|
|
|
|
DOUBLE g_dSnap[33] =
|
|
{
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW52,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW51,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW50,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW49,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW48,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW47,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW46,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW45,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW44,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW43,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW42,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW41,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW40,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW39,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW38,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW37,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW36,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW35,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW34,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW33,
|
|
(DOUBLE)CONST_TWOPOW32 + (DOUBLE)CONST_TWOPOW31,
|
|
(DOUBLE)CONST_TWOPOW31 + (DOUBLE)CONST_TWOPOW30,
|
|
(DOUBLE)CONST_TWOPOW30 + (DOUBLE)CONST_TWOPOW29,
|
|
(DOUBLE)CONST_TWOPOW29 + (DOUBLE)CONST_TWOPOW28,
|
|
(DOUBLE)CONST_TWOPOW28 + (DOUBLE)CONST_TWOPOW27,
|
|
(DOUBLE)CONST_TWOPOW27 + (DOUBLE)CONST_TWOPOW26,
|
|
(DOUBLE)CONST_TWOPOW26 + (DOUBLE)CONST_TWOPOW25,
|
|
(DOUBLE)CONST_TWOPOW25 + (DOUBLE)CONST_TWOPOW24,
|
|
(DOUBLE)CONST_TWOPOW24 + (DOUBLE)CONST_TWOPOW23,
|
|
(DOUBLE)CONST_TWOPOW23 + (DOUBLE)CONST_TWOPOW22,
|
|
(DOUBLE)CONST_TWOPOW22 + (DOUBLE)CONST_TWOPOW21,
|
|
(DOUBLE)CONST_TWOPOW21 + (DOUBLE)CONST_TWOPOW20,
|
|
(DOUBLE)CONST_TWOPOW20 + (DOUBLE)CONST_TWOPOW19,
|
|
};
|