//
// LogL16fromY from 0x6d8fe8 to 0x6d91e8 (512 bytes)
//
// 3 xrefs:
// > sub_6D93F8 @ 0x6d9450
// > LogLuv32fromXYZ @ 0x6dadb4
// > ??> @ 0x584bc
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall LogL16fromY(double a1, int a2)
{
double v4; // d6
double v5; // d6
if ( a1 >= 1.8371976e19 )
return 0x7FFF;
if ( a1 <= -1.8371976e19 )
return 0xFFFF;
if ( a1 <= 5.4136769e-20 )
{
if ( a1 >= -5.4136769e-20 )
{
return 0;
}
else if ( a2 )
{
v5 = log(-a1) * 1.44269504 + 64.0;
return ~((unsigned int)~((int)(v5 * 256.0 + (double)sub_6D7100() * 4.65661288e-10 - 0.5) << 17) >> 17);
}
else
{
return ~((unsigned int)~((int)((log(-a1) * 1.44269504 + 64.0) * 256.0) << 17) >> 17);
}
}
else
{
if ( !a2 )
return (int)((log(a1) * 1.44269504 + 64.0) * 256.0);
v4 = log(a1) * 1.44269504 + 64.0;
return (int)(v4 * 256.0 + (double)sub_6D7100() * 4.65661288e-10 - 0.5);
}
}