microsoft / knossos-ksc

Compiler with automatic differentiation
Other
45 stars 10 forks source link

Fixes for KS_NO_ALLOCATOR #1015

Closed dcrc2 closed 2 years ago

dcrc2 commented 2 years ago

Fix potential build errors when KS_NO_ALLOCATOR is defined. (This is used in #976, where we can actually get away with the current version of the code, but it's clearly incorrect.)

dcrc2 commented 2 years ago

The diff in knossos.h is not very helpful: the issue there is that the function inflated_bytes uses allocator::padded_size, which is only available if KS_ALLOCATOR is defined. Since inflated_bytes is really part of the implementation of copydown, the fix is to move it into the Copydown section, which is all inside an #ifdef KS_ALLOCATOR.