Make 73 numeric constants const, moving them into .rdata (#234)
This change makes the 73 variables in ratconst.h actually inline const, which allows them to move from the mutable .data section of the executable, and into the read-only .rdata section instead. Moving data to the .rdata section has a number of benefits, such as preventing possible corruption due to stray writes, or other memory corruption. Additionally, the initialization at run-time start-up is no longer needed, so there is also a reduction in the .text (code) section as well. As a result the overall size of the Calculator.exe binary (on x64 Release builds) decreases by 1,536 bytes (or ~1.5 KB) with no change in behavior other than a small performance benefit.
This commit is contained in:
committed by
Daniel Belcher
parent
7663c0d5f2
commit
251578047f
@@ -411,7 +411,7 @@ extern void tanrat( _Inout_ PRAT *px, uint32_t radix, int32_t precision);
|
||||
// angle type
|
||||
extern void tananglerat( _Inout_ PRAT *px, ANGLE_TYPE angletype, uint32_t radix, int32_t precision);
|
||||
|
||||
extern void _dupnum(_In_ PNUMBER dest, _In_ PNUMBER src);
|
||||
extern void _dupnum(_In_ PNUMBER dest, _In_ const NUMBER * const src);
|
||||
|
||||
extern void _destroynum( _In_ PNUMBER pnum );
|
||||
extern void _destroyrat( _In_ PRAT prat );
|
||||
|
||||
Reference in New Issue
Block a user