Rover12421's Blog

The End.

Int32转int64

/
    int32 转 int64
*/
int64 int32_to_int64(int32 num_32)
{
    int64 num_64;

    if (num_32 < )
    {
        num_64 = ~num_32;
        num_64 = (~num_64) & 0xffffffff;
    }
    else
    {
        num_64 = num_32;
    }

    return num_64;
}

/
    连接两个int32 到 int64
*/
int64 int32_int32_to_int64(int32 hh, int32 ll)
{
    int64 hh_64;
    int64 ll_64;
   
    hh_64 = int32_to_int64(hh);
    ll_64 = int32_to_int64(ll);   
   
    return (hh_64 << 32) | ll_64;
}

Comments