clang-format source files

Former-commit-id: 39700ad779
This commit is contained in:
Luke Street 2022-10-09 01:16:21 -04:00
parent 7f83e1fa03
commit f0ea5144ea
35 changed files with 211 additions and 264 deletions

View File

@ -1,4 +1,3 @@
// #pragma once
#ifndef _CGUNWEAPON
#define _CGUNWEAPON

View File

@ -7,8 +7,7 @@ CMRay::CMRay(const CVector3f& start, const CVector3f& end, float length, float i
, mDelta(mEnd - mStart)
, mLength(length)
, mInvLength(invLength)
, mDir(mInvLength * mDelta) {
}
, mDir(mInvLength * mDelta) {}
CMRay::CMRay(const CVector3f& start, const CVector3f& dir, float length)
: mStart(start)
@ -18,7 +17,6 @@ CMRay::CMRay(const CVector3f& start, const CVector3f& dir, float length)
, mInvLength(1.f / length)
, mDir(dir) {}
CMRay CMRay::GetInvUnscaledTransformRay(const CTransform4f& xf) const {
CTransform4f invXf = xf.GetQuickInverse();
return CMRay(invXf * mStart, invXf * mEnd, mLength, mInvLength);

View File

@ -7,8 +7,7 @@ COBBox::COBBox(const CTransform4f& xf, const CVector3f& extents)
COBBox::COBBox(CInputStream& in) : mTransform(in), mExtents(in) {}
CAABox COBBox::CalculateAABox(const CTransform4f& xf) const {
}
CAABox COBBox::CalculateAABox(const CTransform4f& xf) const {}
COBBox COBBox::FromAABox(const CAABox& box, const CTransform4f& xf) {
CVector3f center = box.GetCenterPoint();
@ -17,14 +16,10 @@ COBBox COBBox::FromAABox(const CAABox& box, const CTransform4f& xf) {
return COBBox(final, extents);
}
bool COBBox::LineIntersectsBox(const CMRay& ray, float& penetration) const {
}
bool COBBox::LineIntersectsBox(const CMRay& ray, float& penetration) const {}
bool COBBox::AABoxIntersectsBox(const CAABox& box) const {
return OBBIntersectsBox(FromAABox(box, CTransform4f::Identity()));
}
bool COBBox::OBBIntersectsBox(const COBBox& box) const {
return false;
}
bool COBBox::OBBIntersectsBox(const COBBox& box) const { return false; }

View File

@ -345,9 +345,7 @@ void DTKNextTrack() {
}
}
u32 DTKGetState() {
return __DTKState;
}
u32 DTKGetState() { return __DTKState; }
void DTKSetVolume(u8 left, u8 right) {
__DTKVolumeL = left;

View File

@ -4,7 +4,6 @@
CStopwatch::CSWData CStopwatch::mData;
CStopwatch CStopwatch::mGlobalTimer;
bool CStopwatch::InitGlobalTimer() {
mGlobalTimer.Reset();
return true;
@ -18,6 +17,4 @@ void CStopwatch::Wait(float wait) {
}
}
CStopwatch& CStopwatch::GetGlobalTimerObj() {
return mGlobalTimer;
}
CStopwatch& CStopwatch::GetGlobalTimerObj() { return mGlobalTimer; }

View File

@ -134,7 +134,9 @@ float CLight::GetIntensity() const {
if (x1c_type == kLT_Custom) {
coef = x30_angleC;
}
x48_cachedIntensity = coef * rstl::max_val(x18_color.GetRed(), rstl::max_val(x18_color.GetGreen(), x18_color.GetBlue()));
x48_cachedIntensity =
coef *
rstl::max_val(x18_color.GetRed(), rstl::max_val(x18_color.GetGreen(), x18_color.GetBlue()));
}
return x48_cachedIntensity;
}

View File

@ -2,11 +2,10 @@
#include "Kyoto/Math/CMath.hpp"
CPlane::CPlane(const CVector3f& a, const CVector3f& b, const CVector3f& c)
: x0_normal(CVector3f::Cross(b - a, c - a))
, xc_constant(CVector3f::Dot(x0_normal, a)) {
}
: x0_normal(CVector3f::Cross(b - a, c - a)), xc_constant(CVector3f::Dot(x0_normal, a)) {}
float CPlane::ClipLineSegment(const CVector3f& start, const CVector3f& end) const {
float dist = -(CVector3f::Dot(start, GetNormal()) - GetConstant()) / CVector3f::Dot(end - start, GetNormal());
float dist = -(CVector3f::Dot(start, GetNormal()) - GetConstant()) /
CVector3f::Dot(end - start, GetNormal());
return dist <= 0.f ? 0.f : (dist >= 1.f ? 1.f : dist);
}

View File

@ -1,5 +1,4 @@
#include "Kyoto/Math/CUnitVector3f.hpp"
CUnitVector3f::CUnitVector3f(const CVector3f& vec)
: CVector3f(vec.IsNonZero() ? vec.AsNormalized() : CVector3f::Zero()) {
}
: CVector3f(vec.IsNonZero() ? vec.AsNormalized() : CVector3f::Zero()) {}

View File

@ -1,4 +1,3 @@
#include "Kyoto/Math/CVector3i.hpp"
CVector3i::CVector3i(int x, int y, int z)
: mX(x), mY(y), mZ(z) {}
CVector3i::CVector3i(int x, int y, int z) : mX(x), mY(y), mZ(z) {}

View File

@ -1,10 +1,5 @@
#include "Kyoto/Math/CMath.hpp"
float CMath::SqrtF(float x) { return 0.f; }
float CMath::SqrtF(float x) {
return 0.f;
}
double CMath::SqrtD(double x) {
return 0.0;
}
double CMath::SqrtD(double x) { return 0.0; }

View File

@ -1,33 +1,23 @@
#include <Kyoto/Text/CTextParser.hpp>
#include <Kyoto/Text/CTextExecuteBuffer.hpp>
#include <Kyoto/IObjectStore.hpp>
#include <Kyoto/Text/CTextExecuteBuffer.hpp>
CTextParser::CTextParser(IObjectStore& store)
: mObjectStore(store) {}
CTextParser::CTextParser(IObjectStore& store) : mObjectStore(store) {}
void CTextParser::ParseText(CTextExecuteBuffer& buffer, const wchar_t* str, int len) {
}
void CTextParser::ParseText(CTextExecuteBuffer& buffer, const wchar_t* str, int len) {}
uint CTextParser::GetAssetIdFromString(const rstl::string& str) {
uint CTextParser::GetAssetIdFromString(const rstl::string& str) {}
}
uint CTextParser::GetFont(const wchar_t* str, int len) { return -1; }
uint CTextParser::GetFont(const wchar_t* str, int len) {
return -1;
}
uint CTextParser::GetImage(const wchar_t* str, int len) {
return -1;
}
uint CTextParser::GetImage(const wchar_t* str, int len) { return -1; }
uint CTextParser::HandleUserTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) {
return 0;
}
void CTextParser::ParseTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) {
}
void CTextParser::ParseTag(CTextExecuteBuffer& buffer, const wchar_t* string, int len) {}
bool CTextParser::BeginsWith(const wchar_t* str1, int len, const wchar_t* str2) {
int i = 0;

View File

@ -1,11 +1,7 @@
#include "MetroidPrime/CArchMsgParmControllerStatus.hpp"
#include "Kyoto/Alloc/CMemory.hpp"
CArchMsgParmControllerStatus::CArchMsgParmControllerStatus(short channel, bool connected)
: mChannel(channel)
, mConnected(connected) {
}
: mChannel(channel), mConnected(connected) {}
CArchMsgParmControllerStatus::~CArchMsgParmControllerStatus() {}

View File

@ -1,8 +1,6 @@
#include "MetroidPrime/CArchMsgParmInt32.hpp"
#include "Kyoto/Alloc/CMemory.hpp"
CArchMsgParmInt32::CArchMsgParmInt32(int val)
: mVal(val) {}
CArchMsgParmInt32::CArchMsgParmInt32(int val) : mVal(val) {}
CArchMsgParmInt32::~CArchMsgParmInt32() {}

View File

@ -3,8 +3,6 @@
#include "Kyoto/Alloc/CMemory.hpp"
CArchMsgParmInt32Int32VoidPtr::CArchMsgParmInt32Int32VoidPtr(int val1, int val2, const void* ptr)
: mInt1(val1)
, mInt2(val2)
, mPtr(ptr) {}
: mInt1(val1), mInt2(val2), mPtr(ptr) {}
CArchMsgParmInt32Int32VoidPtr::~CArchMsgParmInt32Int32VoidPtr() {}

View File

@ -1,8 +1,6 @@
#include "MetroidPrime/CArchMsgParmReal32.hpp"
#include "Kyoto/Alloc/CMemory.hpp"
CArchMsgParmReal32::CArchMsgParmReal32(float val)
: mVal(val) {}
CArchMsgParmReal32::CArchMsgParmReal32(float val) : mVal(val) {}
CArchMsgParmReal32::~CArchMsgParmReal32() {}

View File

@ -2,11 +2,8 @@
#include "Kyoto/Alloc/CMemory.hpp"
CArchMsgParmUserInput::CArchMsgParmUserInput(const CFinalInput& input)
: mInput(input) {}
CArchMsgParmUserInput::CArchMsgParmUserInput(const CFinalInput& input) : mInput(input) {}
CArchMsgParmUserInput::~CArchMsgParmUserInput() {}
const CFinalInput& CArchMsgParmUserInput::GetUserInput() const {
return mInput;
}
const CFinalInput& CArchMsgParmUserInput::GetUserInput() const { return mInput; }

View File

@ -5,21 +5,13 @@ const CAxisAngle CAxisAngle::sIdentity;
CAxisAngle::CAxisAngle(const CVector3f& vec) : mVector(vec) {}
CAxisAngle::CAxisAngle(const CUnitVector3f& vec, float angle) : mVector(vec * angle) {}
void CAxisAngle::FromVector(const CVector3f& axis) {
mVector = axis;
}
void CAxisAngle::FromVector(const CVector3f& axis) { mVector = axis; }
const CAxisAngle& CAxisAngle::Identity() {
return sIdentity;
}
const CAxisAngle& CAxisAngle::Identity() { return sIdentity; }
const CVector3f& CAxisAngle::GetVector() const {
return mVector;
}
const CVector3f& CAxisAngle::GetVector() const { return mVector; }
float CAxisAngle::GetAngle() const {
return mVector.Magnitude();
}
float CAxisAngle::GetAngle() const { return mVector.Magnitude(); }
const CAxisAngle& CAxisAngle::operator*=(const float& rhs) {
mVector *= rhs;

View File

@ -152,7 +152,8 @@ static inline bool check_hits(EVulnerability vuln, int direct) {
if (!direct) {
return is_not_deflect(vuln);
}
if (vuln == kVN_Deflect || ((u32)vuln - kVN_DirectWeak <= kVN_Normal) || vuln == kVN_DirectImmune) {
if (vuln == kVN_Deflect || ((u32)vuln - kVN_DirectWeak <= kVN_Normal) ||
vuln == kVN_DirectImmune) {
return false;
}
return true;

View File

@ -1,7 +1,6 @@
//#include <MetroidPrime/CMemoryDrawEnum.hpp>
#include <Kyoto/Alloc/IAllocator.hpp>
/* ODR strikes again! */
IAllocator::SMetrics::SMetrics(const SMetrics& other)
: x0_heapSize(other.x0_heapSize)

View File

@ -30,30 +30,16 @@ void CObjectList::AddObject(CEntity& ent) {
void CObjectList::RemoveObject(TUniqueId uid) {}
CEntity* CObjectList::GetObjectById() {
return nullptr;
}
CEntity* CObjectList::GetObjectById() { return nullptr; }
const CEntity* CObjectList::GetObjectById() const {
return nullptr;
}
const CEntity* CObjectList::GetObjectById() const { return nullptr; }
CEntity* CObjectList::GetValidObjectById(TUniqueId uid) {
return nullptr;
}
CEntity* CObjectList::GetValidObjectById(TUniqueId uid) { return nullptr; }
const CEntity* CObjectList::GetValidObjectById(TUniqueId uid) const {
return nullptr;
}
const CEntity* CObjectList::GetValidObjectById(TUniqueId uid) const { return nullptr; }
CEntity* CObjectList::operator[](int idx) {
return nullptr;
}
CEntity* CObjectList::operator[](int idx) { return nullptr; }
const CEntity* CObjectList::operator[](int idx) const {
return nullptr;
}
const CEntity* CObjectList::operator[](int idx) const { return nullptr; }
const CEntity* CObjectList::GetValidObjectByIndex(int idx) const {
return nullptr;
}
const CEntity* CObjectList::GetValidObjectByIndex(int idx) const { return nullptr; }

View File

@ -196,7 +196,6 @@ void CPhysicsActor::MoveToInOneFrameWR(const CVector3f& trans, float d) {
x18c_moveImpulse += (trans - GetTranslation()) * GetMass() * (1.f / d);
}
CVector3f CPhysicsActor::GetMoveToORImpulseWR(const CVector3f& trans, float d) const {
CVector3f impulse = x34_transform.Rotate(trans);
return (GetMass() * impulse) * (1.f / d);

View File

@ -9,7 +9,9 @@
void CCameraFilterPass::DrawWideScreen(const CColor& color, const CTexture* tex, f32 lod) {
const rstl::pair< CVector2f, CVector2f > vp = gpRender->SetViewportOrtho(true, -4096.f, 4096.f);
f32 left = vp.first.GetX();
f32 dVar5 = -((vp.second.GetX() - vp.first.GetX()) * 0.0625f * 9.f - (vp.second.GetY() - vp.first.GetY())) * 0.5f;
f32 dVar5 = -((vp.second.GetX() - vp.first.GetX()) * 0.0625f * 9.f -
(vp.second.GetY() - vp.first.GetY())) *
0.5f;
f32 bottom = vp.first.GetY();
f32 right = vp.second.GetX();
f32 top = vp.second.GetY();

View File

@ -1,12 +1,13 @@
#include "MetroidPrime/Cameras/CCameraHint.hpp"
#include "Kyoto/Alloc/CMemory.hpp"
CCameraHint::CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour, float minDist,
float maxDist, float backwardsDist, const CVector3f& lookAtOffset,
const CVector3f& chaseLookAtOffset, const CVector3f& ballToCam, float fov,
float attitudeRange, float azimuthRange, float anglePerSecond, float clampVelRange,
float clampRotRange, float elevation, float interpolateTime, float clampVelTime,
float controlInterpDur)
CCameraHint::CCameraHint(uint overrideFlags, CBallCamera::EBallCameraBehaviour behaviour,
float minDist, float maxDist, float backwardsDist,
const CVector3f& lookAtOffset, const CVector3f& chaseLookAtOffset,
const CVector3f& ballToCam, float fov, float attitudeRange,
float azimuthRange, float anglePerSecond, float clampVelRange,
float clampRotRange, float elevation, float interpolateTime,
float clampVelTime, float controlInterpDur)
: mOverrideFlags(overrideFlags)
, mBehaviour(behaviour)
, mMinDist(minDist)

View File

@ -9,6 +9,7 @@
#include "MetroidPrime/Cameras/CCameraManager.hpp"
#include "MetroidPrime/Player/CGrappleArm.hpp"
#include "MetroidPrime/Player/CPlayer.hpp"
#include "MetroidPrime/SFX/Weapons.h"
#include "MetroidPrime/Tweaks/CTweakGunRes.hpp"
#include "MetroidPrime/Tweaks/CTweakPlayerGun.hpp"
#include "MetroidPrime/Weapons/CAuxWeapon.hpp"
@ -20,7 +21,6 @@
#include "MetroidPrime/Weapons/CWaveBeam.hpp"
#include "MetroidPrime/Weapons/GunController/CGunMotion.hpp"
#include "MetroidPrime/Weapons/WeaponTypes.hpp"
#include "MetroidPrime/SFX/Weapons.h"
#include "Kyoto/Audio/CSfxManager.hpp"
#include "Kyoto/Graphics/CModelFlags.hpp"
@ -713,7 +713,8 @@ void CPlayerGun::UpdateWeaponFire(float dt, CPlayerState& playerState, CStateMan
x835_29_powerBombReady = false;
if (!x835_31_actorAttached) {
x835_28_bombReady = true;
if (x53a_powerBomb != kInvalidUniqueId && !mgr.CanCreateProjectile(x538_playerId, kWT_PowerBomb, 1)) {
if (x53a_powerBomb != kInvalidUniqueId &&
!mgr.CanCreateProjectile(x538_playerId, kWT_PowerBomb, 1)) {
const CPowerBomb* pb = static_cast< const CPowerBomb* >(mgr.GetObjectById(x53a_powerBomb));
if (pb && pb->GetCurTime() <= 4.25f) {
x835_28_bombReady = false;
@ -752,7 +753,8 @@ void CPlayerGun::UpdateWeaponFire(float dt, CPlayerState& playerState, CStateMan
FireSecondary(dt, mgr);
} else {
if (!CSfxManager::IsPlaying(x2e4_invalidSfx)) {
x2e4_invalidSfx = NWeaponTypes::play_sfx(SFXwpn_invalid_action, x834_27_underwater, false, 0x4a);
x2e4_invalidSfx =
NWeaponTypes::play_sfx(SFXwpn_invalid_action, x834_27_underwater, false, 0x4a);
} else {
x2e4_invalidSfx.Clear();
}
@ -827,14 +829,15 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
x833_24_notFidgeting =
!(player.GetSurfaceRestraint() != CPlayer::kSR_Water &&
mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::kPV_Scan &&
(x2f4_fireButtonStates & 0x3) == 0 && x32c_chargePhase == kCP_NotCharging && !x832_29_lockedOn &&
(x2f8_stateFlags & 0x8) != 0x8 && x364_gunStrikeCoolTimer <= 0.f &&
(x2f4_fireButtonStates & 0x3) == 0 && x32c_chargePhase == kCP_NotCharging &&
!x832_29_lockedOn && (x2f8_stateFlags & 0x8) != 0x8 && x364_gunStrikeCoolTimer <= 0.f &&
player.GetPlayerMovementState() == NPlayer::kMS_OnGround && !player.IsInFreeLook() &&
!player.GetFreeLookStickState() && player.GetOrbitState() == CPlayer::kOS_NoOrbit &&
fabs(player.GetAngularVelocityOR().GetAngle()) <= 0.1f && camBobT <= 0.01f &&
!mgr.GetCameraManager()->IsInCinematicCamera() &&
player.GetGunHolsterState() == CPlayer::kGH_Drawn &&
player.GetGrappleState() == CPlayer::kGS_None && !x834_30_inBigStrike && !x835_25_inPhazonBeam);
player.GetGrappleState() == CPlayer::kGS_None && !x834_30_inBigStrike &&
!x835_25_inPhazonBeam);
if (x833_24_notFidgeting) {
if (!x834_30_inBigStrike) {
bool doWander = camBobT > 0.01f && (x2f4_fireButtonStates & 0x3) == 0;
@ -858,12 +861,14 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
x394_damageTimer = 0.f;
x834_31_gunMotionInFidgetBasePosition = true;
x73c_gunMotion->BasePosition(true);
} else if (!x73c_gunMotion->GetModelData().GetAnimationData()->IsAnimTimeRemaining(0.001f, rstl::string_l("Whole Body"))) {
} else if (!x73c_gunMotion->GetModelData().GetAnimationData()->IsAnimTimeRemaining(
0.001f, rstl::string_l("Whole Body"))) {
x834_30_inBigStrike = false;
x834_31_gunMotionInFidgetBasePosition = false;
}
} else {
switch (x3a4_fidget.Update(x2ec_lastFireButtonStates, camBobT > 0.01f, inStrikeCooldown, dt, mgr)) {
switch (x3a4_fidget.Update(x2ec_lastFireButtonStates, camBobT > 0.01f, inStrikeCooldown, dt,
mgr)) {
case CFidget::kS_NoFidget:
if (x324_idleState != kIS_Idle) {
x73c_gunMotion->PlayPasAnim(SamusGun::kAS_Idle, mgr, 0.f, false);
@ -891,7 +896,8 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
x834_26_animPlaying =
x834_25_gunMotionFidgeting
? x73c_gunMotion->IsAnimPlaying()
: x72c_currentBeam->GetSolidModelData().GetAnimationData()->IsAnimTimeRemaining(0.001f, rstl::string_l("Whole Body"));
: x72c_currentBeam->GetSolidModelData().GetAnimationData()->IsAnimTimeRemaining(
0.001f, rstl::string_l("Whole Body"));
if (!x834_26_animPlaying) {
x3a4_fidget.ResetMinor();
ReturnToRestPose();
@ -906,7 +912,6 @@ void CPlayerGun::UpdateGunIdle(bool inStrikeCooldown, float camBobT, float dt, C
}
}
void CPlayerGun::CMotionState::Update(bool, float, CTransform4f&, CStateManager&) {}
void CPlayerGun::DamageRumble(const CVector3f&, const CStateManager&) {}
@ -959,9 +964,7 @@ void CPlayerGun::AsyncLoadFidget(CStateManager&) {}
void CPlayerGun::UnLoadFidget() {}
bool CPlayerGun::IsFidgetLoaded() {
return false;
}
bool CPlayerGun::IsFidgetLoaded() { return false; }
void CPlayerGun::SetFidgetAnimBits(int, bool) {}

View File

@ -1,9 +1,7 @@
#include "MetroidPrime/ScriptObjects/CFire.hpp"
#include "MetroidPrime/CActorParameters.hpp"
static inline CMaterialList MakeMaterialList() {
return CMaterialList(kMT_Projectile);
}
static inline CMaterialList MakeMaterialList() { return CMaterialList(kMT_Projectile); }
CFire::CFire(TToken< CGenDescription > effect, TUniqueId uid, TAreaId area, bool active,
TUniqueId owner, const CTransform4f& xf, const CDamageInfo& dInfo, const CAABox& aabox,
@ -33,7 +31,4 @@ CFire::CFire(TToken< CGenDescription > effect, TUniqueId uid, TAreaId area, bool
xe8_->SetTranslation(xf.GetTranslation());
}
CFire::~CFire() {
}
CFire::~CFire() {}

View File

@ -17,9 +17,7 @@ void CGunController::EnterStruck(CStateManager&, float) {}
void CGunController::LoadFidgetAnimAsync(CStateManager&, int, int, int) {}
int CGunController::Update(float, CStateManager&) {
return 0;
}
int CGunController::Update(float, CStateManager&) { return 0; }
void CGunController::EnterIdle(CStateManager&) {}

View File

@ -80,9 +80,7 @@ void CGunMotion::ReturnToDefault(CStateManager& mgr) {
x4c_gunController.ReturnToDefault(mgr, 0.f);
}
int CGunMotion::GetFreeLookSetId() const {
return x4c_gunController.GetFreeLookSetId();
}
int CGunMotion::GetFreeLookSetId() const { return x4c_gunController.GetFreeLookSetId(); }
void CGunMotion::BasePosition(bool bigStrikeReset) {
CAnimData& animData = *x0_modelData.AnimationData();

View File

@ -1,4 +1,5 @@
#pragma once
#ifndef _NMWEXCEPTION
#define _NMWEXCEPTION
#ifdef __cplusplus
extern "C" {
@ -18,3 +19,5 @@ void __destroy_global_chain(void);
#ifdef __cplusplus
}
#endif
#endif // _NMWEXCEPTION

View File

@ -1,6 +1,5 @@
#include "string.h"
void* memcpy(void* dst, const void* src, size_t n) {
const char* p;
char* q;
@ -18,7 +17,6 @@ void* memcpy(void* dst, const void* src, size_t n) {
return (dst);
}
#define cps ((unsigned char*)src)
#define cpd ((unsigned char*)dst)
#define lps ((unsigned long*)src)

View File

@ -77,15 +77,24 @@ static const double
static double
#endif
one = 1.0,
halF[2] = {0.5,-0.5,},
huge = 1.0e+300,
twom1000= 9.33263618503218878990e-302, /* 2**-1000=0x01700000,0*/
halF[2] =
{
0.5,
-0.5,
},
huge = 1.0e+300, twom1000 = 9.33263618503218878990e-302, /* 2**-1000=0x01700000,0*/
o_threshold = 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
u_threshold = -7.45133219101941108420e+02, /* 0xc0874910, 0xD52D3051 */
ln2HI[2] ={ 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
-6.93147180369123816490e-01,},/* 0xbfe62e42, 0xfee00000 */
ln2LO[2] ={ 1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */
-1.90821492927058770002e-10,},/* 0xbdea39ef, 0x35793c76 */
ln2HI[2] =
{
6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
-6.93147180369123816490e-01,
}, /* 0xbfe62e42, 0xfee00000 */
ln2LO[2] =
{
1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */
-1.90821492927058770002e-10,
}, /* 0xbdea39ef, 0x35793c76 */
invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */
P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */
P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */
@ -110,15 +119,20 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
if (hx >= 0x7ff00000) {
if (((hx & 0xfffff) | __LO(x)) != 0)
return x + x; /* NaN */
else return (xsb==0)? x:0.0; /* ieee_exp(+-inf)={inf,0} */
else
return (xsb == 0) ? x : 0.0; /* ieee_exp(+-inf)={inf,0} */
}
if(x > o_threshold) return huge*huge; /* overflow */
if(x < u_threshold) return twom1000*twom1000; /* underflow */
if (x > o_threshold)
return huge * huge; /* overflow */
if (x < u_threshold)
return twom1000 * twom1000; /* underflow */
}
/* argument reduction */
if (hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
if (hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
hi = x - ln2HI[xsb];
lo = ln2LO[xsb];
k = 1 - xsb - xsb;
} else {
k = (int)(invln2 * x + halF[xsb]);
t = k;
@ -126,16 +140,18 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
lo = t * ln2LO[0];
}
x = hi - lo;
}
else if(hx < 0x3e300000) { /* when |x|<2**-28 */
if(huge+x>one) return one+x;/* trigger inexact */
}
else k = 0;
} else if (hx < 0x3e300000) { /* when |x|<2**-28 */
if (huge + x > one)
return one + x; /* trigger inexact */
} else
k = 0;
/* x is now in primary range */
t = x * x;
c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5))));
if(k==0) return one-((x*c)/(c-2.0)-x);
else y = one-((lo-(x*c)/(2.0-c))-hi);
if (k == 0)
return one - ((x * c) / (c - 2.0) - x);
else
y = one - ((lo - (x * c) / (2.0 - c)) - hi);
if (k >= -1021) {
__HI(y) += (k << 20); /* add k to y's exponent */
return y;

View File

@ -21,6 +21,4 @@ void salCrossProduct(SND_FVECTOR* out, const SND_FVECTOR* a, const SND_FVECTOR*
out->z = (a->x * b->y) - (a->y * b->x);
}
void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in) {
out->t[0] = 1.f;
}
void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in) { out->t[0] = 1.f; }