Skip to content

Commit

Permalink
fix assert for x86
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed May 7, 2024
1 parent 0cd3709 commit 4993257
Show file tree
Hide file tree
Showing 20 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion core/src/xmake/base64/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tb_int_t xm_base64_encode(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// encode it
tb_char_t buff[8192];
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/bloom_filter/bloom_filter_data_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ tb_int_t xm_bloom_filter_data_set(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// set data
tb_bool_t ok = tb_bloom_filter_data_set(filter, data, size);
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/hash/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tb_int_t xm_hash_md5(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// compute md5
tb_byte_t buffer[16];
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/hash/sha.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ tb_int_t xm_hash_sha(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// compute sha
tb_sha_t sha;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/hash/xxhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ tb_int_t xm_hash_xxhash(lua_State* lua)
// is bytes? get data and size
if (xm_lua_isinteger(lua, 2) && xm_lua_isinteger(lua, 3))
{
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_byte_t const* data = (tb_byte_t const*)(tb_size_t)(tb_long_t)lua_tointeger(lua, 2);
tb_size_t size = (tb_size_t)lua_tointeger(lua, 3);
if (!data || !size)
Expand All @@ -63,6 +62,7 @@ tb_int_t xm_hash_xxhash(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// compuate hash
tb_byte_t const* buffer;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/io/file_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ tb_int_t xm_io_file_write(lua_State* lua)
if (xm_lua_isinteger(lua, -1))
data = (tb_byte_t const*)(tb_size_t)(tb_long_t)lua_tointeger(lua, -1);
lua_pop(lua, 1);
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

lua_pushstring(lua, "size");
lua_gettable(lua, i);
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/io/pipe_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tb_int_t xm_io_pipe_read(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p)!", data);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// get size
tb_long_t size = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/io/pipe_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ tb_int_t xm_io_pipe_write(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// write data
tb_long_t real = tb_pipe_file_write(pipefile, data, size);
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/io/socket_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tb_int_t xm_io_socket_recv(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p)!", data);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// get size
tb_long_t size = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/io/socket_recvfrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tb_int_t xm_io_socket_recvfrom(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p)!", data);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// get size
tb_long_t size = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/io/socket_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ tb_int_t xm_io_socket_send(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// send data
tb_long_t real = tb_socket_send(sock, data, size);
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/io/socket_sendto.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ tb_int_t xm_io_socket_sendto(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// get address
tb_char_t const* addr = lua_tostring(lua, 4);
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/lz4/block_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tb_int_t xm_lz4_block_compress(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// do compress
tb_bool_t ok = tb_false;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/lz4/block_decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tb_int_t xm_lz4_block_decompress(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// get real size
tb_int_t real = (tb_int_t)lua_tointeger(lua, 3);
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/lz4/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tb_int_t xm_lz4_compress(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// do compress
tb_bool_t ok = tb_false;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/lz4/compress_stream_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ tb_int_t xm_lz4_compress_stream_read(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p)!", data);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// get size
tb_long_t size = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/lz4/compress_stream_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tb_int_t xm_lz4_compress_stream_write(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// is end?
tb_bool_t end = tb_false;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/lz4/decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tb_int_t xm_lz4_decompress(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// do decompress
tb_bool_t ok = tb_false;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/lz4/decompress_stream_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ tb_int_t xm_lz4_decompress_stream_read(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p)!", data);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// get size
tb_long_t size = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/src/xmake/lz4/decompress_stream_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tb_int_t xm_lz4_decompress_stream_write(lua_State* lua)
lua_pushfstring(lua, "invalid data(%p) and size(%d)!", data, (tb_int_t)size);
return 2;
}
tb_assert_static(sizeof(lua_Integer) == sizeof(tb_pointer_t));
tb_assert_static(sizeof(lua_Integer) >= sizeof(tb_pointer_t));

// write data
tb_long_t real = xm_lz4_dstream_write(stream, data, size, tb_false);
Expand Down

0 comments on commit 4993257

Please sign in to comment.