Cleaning.

This commit is contained in:
Daniel Lemire 2018-11-27 17:38:53 -05:00
parent 58ac242770
commit ba0f6fea51
1 changed files with 9 additions and 14 deletions

View File

@ -97,38 +97,33 @@ public:
// //
// this should be considered a private function // this should be considered a private function
inline void write_tape(u64 val, u8 c) { really_inline void write_tape(u64 val, u8 c) {
tape[current_loc++] = val | (((u64)c) << 56); tape[current_loc++] = val | (((u64)c) << 56);
//tape[tape_locs[depth]] = val | (((u64)c) << 56); //tape[tape_locs[depth]] = val | (((u64)c) << 56);
//tape_locs[depth]++; //tape_locs[depth]++;
} }
inline void write_tape_s64(s64 i) { really_inline void write_tape_s64(s64 i) {
memcpy(current_number_buf_loc, &i, sizeof(s64));
//*((s64 *)current_number_buf_loc) = i;// safe because array will be 8-byte aligned, could use memcpy
current_number_buf_loc += sizeof(s64);
write_tape(current_number_buf_loc - number_buf, 'l'); write_tape(current_number_buf_loc - number_buf, 'l');
memcpy(current_number_buf_loc, &i, sizeof(s64));
current_number_buf_loc += sizeof(s64);
} }
inline void write_tape_double(double d) { really_inline void write_tape_double(double d) {
memcpy(current_number_buf_loc, &d, sizeof(double));
//*((double *)current_number_buf_loc) = d;// safe because array will be 8-byte aligned, could use memcpy
current_number_buf_loc += sizeof(double);
write_tape(current_number_buf_loc - number_buf, 'd'); write_tape(current_number_buf_loc - number_buf, 'd');
memcpy(current_number_buf_loc, &d, sizeof(double));
current_number_buf_loc += sizeof(double);
} }
inline u32 get_current_loc() { really_inline u32 get_current_loc() {
return current_loc; return current_loc;
} }
inline void annotate_previousloc(u32 saved_loc,u64 val) { really_inline void annotate_previousloc(u32 saved_loc,u64 val) {
tape[saved_loc] |= val; tape[saved_loc] |= val;
} }
/*void write_saved_loc(u32 saved_loc, u64 val, u8 c) {
tape[saved_loc] = val | (((u64)c) << 56);
}*/
// public interface // public interface
#if 1 #if 1