diff --git a/core/src/xmake/base64/encode.c b/core/src/xmake/base64/encode.c index 8bb4d8be3a8..acf0b7c2546 100644 --- a/core/src/xmake/base64/encode.c +++ b/core/src/xmake/base64/encode.c @@ -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]; diff --git a/core/src/xmake/bloom_filter/bloom_filter_data_set.c b/core/src/xmake/bloom_filter/bloom_filter_data_set.c index cbf1cafdac1..6de4a5d4aef 100644 --- a/core/src/xmake/bloom_filter/bloom_filter_data_set.c +++ b/core/src/xmake/bloom_filter/bloom_filter_data_set.c @@ -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); diff --git a/core/src/xmake/hash/md5.c b/core/src/xmake/hash/md5.c index d24ca7e5359..c9ec2fb369f 100644 --- a/core/src/xmake/hash/md5.c +++ b/core/src/xmake/hash/md5.c @@ -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]; diff --git a/core/src/xmake/hash/sha.c b/core/src/xmake/hash/sha.c index a4c0356fb03..720647cdf84 100644 --- a/core/src/xmake/hash/sha.c +++ b/core/src/xmake/hash/sha.c @@ -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; diff --git a/core/src/xmake/hash/xxhash.c b/core/src/xmake/hash/xxhash.c index 232e9c2f844..12dd3ba1084 100644 --- a/core/src/xmake/hash/xxhash.c +++ b/core/src/xmake/hash/xxhash.c @@ -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) @@ -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; diff --git a/core/src/xmake/io/file_write.c b/core/src/xmake/io/file_write.c index d11cb0259c1..9411efc318b 100644 --- a/core/src/xmake/io/file_write.c +++ b/core/src/xmake/io/file_write.c @@ -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); diff --git a/core/src/xmake/io/pipe_read.c b/core/src/xmake/io/pipe_read.c index 76b245ff80a..9644e9e1429 100644 --- a/core/src/xmake/io/pipe_read.c +++ b/core/src/xmake/io/pipe_read.c @@ -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; diff --git a/core/src/xmake/io/pipe_write.c b/core/src/xmake/io/pipe_write.c index 6089c5807b0..847e5754453 100644 --- a/core/src/xmake/io/pipe_write.c +++ b/core/src/xmake/io/pipe_write.c @@ -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); diff --git a/core/src/xmake/io/socket_recv.c b/core/src/xmake/io/socket_recv.c index 71113b6f22c..efe8f9612df 100644 --- a/core/src/xmake/io/socket_recv.c +++ b/core/src/xmake/io/socket_recv.c @@ -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; diff --git a/core/src/xmake/io/socket_recvfrom.c b/core/src/xmake/io/socket_recvfrom.c index 9ca9da23986..cec34847eda 100644 --- a/core/src/xmake/io/socket_recvfrom.c +++ b/core/src/xmake/io/socket_recvfrom.c @@ -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; diff --git a/core/src/xmake/io/socket_send.c b/core/src/xmake/io/socket_send.c index 4efc7cde6c9..0f8656c6cac 100644 --- a/core/src/xmake/io/socket_send.c +++ b/core/src/xmake/io/socket_send.c @@ -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); diff --git a/core/src/xmake/io/socket_sendto.c b/core/src/xmake/io/socket_sendto.c index ad1a09856de..cd236cdcf50 100644 --- a/core/src/xmake/io/socket_sendto.c +++ b/core/src/xmake/io/socket_sendto.c @@ -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); diff --git a/core/src/xmake/lz4/block_compress.c b/core/src/xmake/lz4/block_compress.c index 1748e9cdf1d..36238ff8b63 100644 --- a/core/src/xmake/lz4/block_compress.c +++ b/core/src/xmake/lz4/block_compress.c @@ -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; diff --git a/core/src/xmake/lz4/block_decompress.c b/core/src/xmake/lz4/block_decompress.c index 713e4c4ec5c..23795f003e0 100644 --- a/core/src/xmake/lz4/block_decompress.c +++ b/core/src/xmake/lz4/block_decompress.c @@ -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); diff --git a/core/src/xmake/lz4/compress.c b/core/src/xmake/lz4/compress.c index daeef656de7..7706128318e 100644 --- a/core/src/xmake/lz4/compress.c +++ b/core/src/xmake/lz4/compress.c @@ -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; diff --git a/core/src/xmake/lz4/compress_stream_read.c b/core/src/xmake/lz4/compress_stream_read.c index f9b9e7f130a..9cf665921e7 100644 --- a/core/src/xmake/lz4/compress_stream_read.c +++ b/core/src/xmake/lz4/compress_stream_read.c @@ -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; diff --git a/core/src/xmake/lz4/compress_stream_write.c b/core/src/xmake/lz4/compress_stream_write.c index 5e588e1ab75..2b467073d46 100644 --- a/core/src/xmake/lz4/compress_stream_write.c +++ b/core/src/xmake/lz4/compress_stream_write.c @@ -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; diff --git a/core/src/xmake/lz4/decompress.c b/core/src/xmake/lz4/decompress.c index fd3a775432e..1f979c16e45 100644 --- a/core/src/xmake/lz4/decompress.c +++ b/core/src/xmake/lz4/decompress.c @@ -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; diff --git a/core/src/xmake/lz4/decompress_stream_read.c b/core/src/xmake/lz4/decompress_stream_read.c index bb9f8306dbd..75eda17e9cf 100644 --- a/core/src/xmake/lz4/decompress_stream_read.c +++ b/core/src/xmake/lz4/decompress_stream_read.c @@ -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; diff --git a/core/src/xmake/lz4/decompress_stream_write.c b/core/src/xmake/lz4/decompress_stream_write.c index 74fe0dae13a..2f5e491a1f7 100644 --- a/core/src/xmake/lz4/decompress_stream_write.c +++ b/core/src/xmake/lz4/decompress_stream_write.c @@ -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);