本文介绍了如何指定在VS2008一个64位无符号整型常量0x8000000000000000?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看了一下微软特定后缀为I64整型常量。我想做一个无符号转变为ULONGLONG。结果
ULONGLONG bigNum64 =​​ 0x800000000000000i64>>设为myVal;

I read about the Microsoft specific suffix "i64" for integer constants. I want to do an UNsigned shift to a ULONGLONG.
ULONGLONG bigNum64 = 0x800000000000000i64 >> myval;

在普通的C,我会使用后缀U,例如类似的32位操作会结果
ULONG bigNum32 = 0x80000000U>>设为myVal;

In normal C, I would use the suffix "U", e.g. the similar 32 bit operation would be
ULONG bigNum32 = 0x80000000U >> myval;

我不希望2的补符号扩展到通过高位传播完成。我想在一个64位的常量数量UNS​​IGNED转变。我想我的第一次发言是要做一个有符号右移。

I do NOT want the 2's complement sign extension to propogate through the high bits. I want an UNSIGNED shift on a 64 bit const number. I think my first statement is going to do a SIGNED shift right.

我试过 0x800000000000000i64U 0x800000000000000u64 但得到编译器错误。

I tried 0x800000000000000i64U and 0x800000000000000u64 but got compiler errors.

推荐答案

您可以使用后缀 ULL ,这是标准的(C99和C ++ 0x中)的方式指定一个无符号长长整数文字和<$​​ C $ C>长长至少为64位。

You can use the suffix ull, which is the standard (C99 and C++0x) way to specify an unsigned long long integer literal, and a long long is at least 64 bits.

这篇关于如何指定在VS2008一个64位无符号整型常量0x8000000000000000?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 18:08