mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 22:09:19 -07:00
1f596a23af
This is undefined behavior in C++.
34 lines
813 B
C++
34 lines
813 B
C++
// Copyright 2009 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#include "VideoCommon/BPMemory.h"
|
|
|
|
#include <cstring>
|
|
|
|
// BP state
|
|
// STATE_TO_SAVE
|
|
BPMemory bpmem;
|
|
|
|
float FogParam0::GetA() const
|
|
{
|
|
// scale mantissa from 11 to 23 bits
|
|
const u32 integral = (static_cast<u32>(sign) << 31) | (static_cast<u32>(exponent) << 23) |
|
|
(static_cast<u32>(mantissa) << 12);
|
|
|
|
float real;
|
|
std::memcpy(&real, &integral, sizeof(u32));
|
|
return real;
|
|
}
|
|
|
|
float FogParam3::GetC() const
|
|
{
|
|
// scale mantissa from 11 to 23 bits
|
|
const u32 integral = (static_cast<u32>(c_sign) << 31) | (static_cast<u32>(c_exp) << 23) |
|
|
(static_cast<u32>(c_mant) << 12);
|
|
|
|
float real;
|
|
std::memcpy(&real, &integral, sizeof(u32));
|
|
return real;
|
|
}
|