@@ -1772,6 +1772,62 @@ EBM_API_BODY ErrorEbm EBM_CALLING_CONVENTION SafeStandardDeviation(
17721772 return Error_None;
17731773}
17741774
1775+ EBM_API_BODY void EBM_CALLING_CONVENTION SafeExp (IntEbm count, double * inout) {
1776+ if (count <= IntEbm{0 }) {
1777+ if (count < IntEbm{0 }) {
1778+ LOG_0 (Trace_Error, " ERROR SafeExp count < IntEbm{0}" );
1779+ }
1780+ return ;
1781+ }
1782+ if (IsConvertError<size_t >(count)) {
1783+ LOG_0 (Trace_Error, " ERROR SafeExp IsConvertError<size_t>(count)" );
1784+ return ;
1785+ }
1786+ const size_t c = static_cast <size_t >(count);
1787+
1788+ if (IsMultiplyError (sizeof (*inout), c)) {
1789+ LOG_0 (Trace_Error, " ERROR SafeExp IsMultiplyError(sizeof(*inout), c)" );
1790+ return ;
1791+ }
1792+
1793+ if (nullptr == inout) {
1794+ LOG_0 (Trace_Error, " ERROR SafeExp nullptr == inout" );
1795+ return ;
1796+ }
1797+
1798+ Exp_Cpu_64 (c, inout);
1799+
1800+ // TODO: add a SIMD version here
1801+ }
1802+
1803+ EBM_API_BODY void EBM_CALLING_CONVENTION SafeLog (IntEbm count, double * inout) {
1804+ if (count <= IntEbm{0 }) {
1805+ if (count < IntEbm{0 }) {
1806+ LOG_0 (Trace_Error, " ERROR SafeLog count < IntEbm{0}" );
1807+ }
1808+ return ;
1809+ }
1810+ if (IsConvertError<size_t >(count)) {
1811+ LOG_0 (Trace_Error, " ERROR SafeLog IsConvertError<size_t>(count)" );
1812+ return ;
1813+ }
1814+ const size_t c = static_cast <size_t >(count);
1815+
1816+ if (IsMultiplyError (sizeof (*inout), c)) {
1817+ LOG_0 (Trace_Error, " ERROR SafeLog IsMultiplyError(sizeof(*inout), c)" );
1818+ return ;
1819+ }
1820+
1821+ if (nullptr == inout) {
1822+ LOG_0 (Trace_Error, " ERROR SafeLog nullptr == inout" );
1823+ return ;
1824+ }
1825+
1826+ Log_Cpu_64 (c, inout);
1827+
1828+ // TODO: add a SIMD version here
1829+ }
1830+
17751831// we don't care if an extra log message is outputted due to the non-atomic nature of the decrement to this value
17761832static int g_cLogEnterGetHistogramCutCount = 25 ;
17771833static int g_cLogExitGetHistogramCutCount = 25 ;
0 commit comments