aboutsummaryrefslogtreecommitdiff
path: root/src/hash/crc.c
diff options
context:
space:
mode:
authorame <[email protected]>2024-04-05 22:15:55 -0500
committerame <[email protected]>2024-04-05 22:15:55 -0500
commitb8c10dac99316974d142c530356ad5cd8fdf9afa (patch)
treeb91c803a9a3ed3b391166684f0ac940c44977f17 /src/hash/crc.c
parent18657b5d226f5fe20ea049308b5078fd188ae96c (diff)
+ + final fixes
Diffstat (limited to 'src/hash/crc.c')
-rw-r--r--src/hash/crc.c15
1 files changed, 3 insertions, 12 deletions
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);