示例#1
0
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);
}
示例#2
0
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);
}
示例#3
0
文件: uint16.c 项目: 1060460048/tbox
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);
}
示例#4
0
文件: uint16.c 项目: 1060460048/tbox
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));
}
示例#5
0
文件: uint16.c 项目: 1060460048/tbox
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);
}
示例#6
0
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)));
}
示例#7
0
/* //////////////////////////////////////////////////////////////////////////////////////
 * 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);
}
示例#8
0
文件: uint16.c 项目: 1060460048/tbox
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));
}
示例#9
0
文件: uint16.c 项目: 1060460048/tbox
/* //////////////////////////////////////////////////////////////////////////////////////
 * 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);
}