//
// LogL16fromY from 0x8e8ba8 to 0x8e8da8 (512 bytes)
//
// 3 xrefs:
// > sub_8E8FB8 @ 0x8e9010
// > LogLuv32fromXYZ @ 0x8ea974
// > ??> @ 0x6b4fc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:04:11 +0000
//
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_8E6CC0() * 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_8E6CC0() * 4.65661288e-10 - 0.5);
}
}