From b8c10dac99316974d142c530356ad5cd8fdf9afa Mon Sep 17 00:00:00 2001 From: ame Date: Fri, 5 Apr 2024 22:15:55 -0500 Subject: + + final fixes --- src/hash/crc.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/hash/crc.c') diff --git a/src/hash/crc.c b/src/hash/crc.c index 71047cc..f52e005 100644 --- a/src/hash/crc.c +++ b/src/hash/crc.c @@ -87,10 +87,7 @@ common_hash_init_update(crc16); common_hash_init_update(crc8); int l_crc8_final(lua_State* L){ - lua_pushstring(L, "ud"); - lua_gettable(L, 1); - - struct crc8_hash* a = (struct crc8_hash*)lua_touserdata(L, -1); + struct crc8_hash* a = (struct crc8_hash*)lua_touserdata(L, 1); uint32_t u = crc8_final(a); char digest[8]; sprintf(digest,"%x",u); @@ -99,10 +96,7 @@ int l_crc8_final(lua_State* L){ } int l_crc16_final(lua_State* L){ - lua_pushstring(L, "ud"); - lua_gettable(L, 1); - - struct crc16_hash* a = (struct crc16_hash*)lua_touserdata(L, -1); + struct crc16_hash* a = (struct crc16_hash*)lua_touserdata(L, 1); uint32_t u = crc16_final(a); char digest[16]; sprintf(digest,"%04x",u); @@ -111,10 +105,7 @@ int l_crc16_final(lua_State* L){ } int l_crc32_final(lua_State* L){ - lua_pushstring(L, "ud"); - lua_gettable(L, 1); - - struct crc32_hash* a = (struct crc32_hash*)lua_touserdata(L, -1); + struct crc32_hash* a = (struct crc32_hash*)lua_touserdata(L, 1); uint32_t u = crc32_final(a); char digest[32]; sprintf(digest,"%08x",u); -- cgit v1.2.3