Very very very close on hashcode.o

This commit is contained in:
Headpenguin 2023-08-25 18:17:22 -04:00
parent 20db0ef224
commit b1f9a24699

View File

@ -4,60 +4,24 @@
namespace JGadget {
s32 doCrazyThings(s32 &term, s32 seed) {return term = seed;}
inline bool gg(u8 &dst, const char *data, s32 terminator) {
*(u8 *)&dst = *data;
// We need to create a percieved side-effect so that the compiler
// falsely believes the initial value of dst is significant for the loop
inline bool gg(u8 &dst, const char *data, s32 terminator, const u8 &out2) {
//*((char *)data - 1) = dst;
const_cast<u8 &>(out2) = dst;
dst = *data;
return (s8)dst != terminator;
}
inline void helper(s32 &acc, const char *data) {
inline u8 helper(s32 &acc, const char *data, u8 &tt) {
//doCrazyThings(acc, acc);
//s32 tmp1 = 0;
// = 0;
//char tmpValue2;
s32 term = 0;
s32 &terminator = term;
char tt;
while(*data != term) {
//terminator = *data - *data;
//s32 tmp2 = tmp1;
//tmp1 = acc + 1;
//tmp1 = tmp2;
// doCrazyThings(tmp1, tmp1);
//unimportant = *data;
doCrazyThings(terminator, terminator);
tt = *data;
data++;
s32 tmp = acc * 31;
acc = tt;
acc += tmp;
//acc += tmp;
}
}
void mull(s32 &a, s32 b) {a = b * 31;}
inline void function(const char *data, s32 &r4, s32 &acc, char &r6) {
for(s32 terminator = *data - *data; (r4 = r6 = *data) != terminator;) {
mull(r4, acc);
acc = r6;
acc += r4;
data++;
}
}
u8 doubleBS(u8 &a, u8 b) {return a = b;}
u32 getHashCode(const char *data) {
s32 acc = 0;
//doCrazyThings(acc, acc);
//s32 tmp1 = 0;
// = 0;
//char tmpValue2;
//doCrazyThings(acc, acc);
//s32 tmp1 = 0;
// = 0;
//char tmpValue2;
u8 tt;// = *data;
//doubleBS(tt, tt);
s32 term = 0;
s32 &terminator = term;
//char &ttt = tt;
while(gg(tt, data, term)) {
const u8 useless = 0;
while(gg(tt, data, term, useless)) {
//terminator = *data - *data;
//s32 tmp2 = tmp1;
//tmp1 = acc + 1;
@ -70,15 +34,38 @@ namespace JGadget {
//s32 tmp = ;
//acc = 0;
data++;
acc = (s8)tt + acc * 31;
acc = (s8)tt + acc * 31 + useless;
doCrazyThings(terminator, terminator);
//tt++;
//acc += tmp;
//tt = *data;
//acc += tmp;
}
return useless;
}
void mull(s32 &a, s32 b) {a = b * 31;}
inline void function(const char *data, s32 &r4, s32 &acc, char &r6) {
for(s32 terminator = *data - *data; (r4 = r6 = *data) != terminator;) {
mull(r4, acc);
acc = r6;
acc += r4;
data++;
}
}
char doubleBS(char &a, char b) {return a = b;}
u32 getHashCode(const char *data) {
s32 acc = 0;
u8 tt;// = *data;
//doCrazyThings(acc, acc);
//s32 tmp1 = 0;
// = 0;
//char tmpValue2;
//doCrazyThings(acc, acc);
//s32 tmp1 = 0;
// = 0;
//char tmpValue2;
helper(acc, data, tt);
//char &ttt = tt;
return acc;
/*s32 r4 = 0, acc = 0;