static tb_void_t tb_element_uint16_copy(tb_element_ref_t element, tb_pointer_t buff, tb_cpointer_t data) { // check tb_assert_and_check_return(buff); // copy element *((tb_uint16_t*)buff) = tb_p2u16(data); }
static tb_void_t tb_element_uint16_ncopy(tb_element_ref_t element, tb_pointer_t buff, tb_cpointer_t data, tb_size_t size) { // check tb_assert_and_check_return(buff); // copy elements tb_memset_u16(buff, tb_p2u16(data), size); }
static tb_void_t tb_item_func_uint16_copy(tb_item_func_t* func, tb_pointer_t buff, tb_cpointer_t data) { // check tb_assert_and_check_return(buff); // copy item *((tb_uint16_t*)buff) = tb_p2u16(data); }
static tb_bool_t tb_item_func_uint16_save(tb_item_func_t* func, tb_cpointer_t data, tb_stream_ref_t stream) { // check tb_assert_and_check_return_val(stream, tb_false); // save it return tb_stream_bwrit_u16_be(stream, tb_p2u16(data)); }
static tb_void_t tb_item_func_uint16_ncopy(tb_item_func_t* func, tb_pointer_t buff, tb_cpointer_t data, tb_size_t size) { // check tb_assert_and_check_return(buff); // copy items tb_memset_u16(buff, tb_p2u16(data), size); }
static tb_long_t tb_element_uint16_comp(tb_element_ref_t element, tb_cpointer_t ldata, tb_cpointer_t rdata) { // compare it return ((tb_p2u16(ldata) < tb_p2u16(rdata))? -1 : (tb_p2u16(ldata) > tb_p2u16(rdata))); }
/* ////////////////////////////////////////////////////////////////////////////////////// * implementation */ static tb_size_t tb_element_uint16_hash(tb_element_ref_t element, tb_cpointer_t data, tb_size_t mask, tb_size_t index) { return tb_element_hash_uint16(tb_p2u16(data), mask, index); }
static tb_long_t tb_item_func_uint16_comp(tb_item_func_t* func, tb_cpointer_t ldata, tb_cpointer_t rdata) { // compare it return (tb_p2u16(ldata) > tb_p2u16(rdata)? 1 : (tb_p2u16(ldata) < tb_p2u16(rdata)? -1 : 0)); }
/* ////////////////////////////////////////////////////////////////////////////////////// * implementation */ static tb_size_t tb_item_func_uint16_hash(tb_item_func_t* func, tb_cpointer_t data, tb_size_t mask, tb_size_t index) { return tb_item_func_hash_uint16(tb_p2u16(data), mask, index); }