本文整理汇总了C#中UInt64类的典型用法代码示例。如果您正苦于以下问题:C# UInt64类的具体用法?C# UInt64怎么用?C# UInt64使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UInt64类属于命名空间,在下文中一共展示了UInt64类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: generate
public static int[] generate(UInt64 n, UInt64 start)
{
int[] ReturnArray = new int[n];
IntPtr d = primesieve_generate_n_primes(n, start, 2);
Marshal.Copy(d, ReturnArray, (int)0, (int)n);
return ReturnArray;
}
开发者ID:JeremyLWright,项目名称:euler,代码行数:7,代码来源:Program.cs
示例2: BigEndian
/// <summary>
/// Converts a <see cref="UInt64"/> to big endian notation.
/// </summary>
/// <param name="input">The <see cref="UInt64"/> to convert.</param>
/// <returns>The converted <see cref="UInt64"/>.</returns>
public static UInt64 BigEndian(UInt64 input)
{
if (!BitConverter.IsLittleEndian)
return input;
return Swap(input);
}
开发者ID:neokamikai,项目名称:rolib,代码行数:12,代码来源:EndianConverter.cs
示例3: NewTotalCount
/// <summary>
/// A helper method for creating an object that represents a total count
/// of objects that the cmdlet would return without paging
/// (this can be more than the size of the page specified in the <see cref="First"/> cmdlet parameter).
/// </summary>
/// <param name="totalCount">a total count of objects that the cmdlet would return without paging</param>
/// <param name="accuracy">
/// accuracy of the <paramref name="totalCount"/> parameter.
/// <c>1.0</c> means 100% accurate;
/// <c>0.0</c> means that total count is unknown;
/// anything in-between means that total count is estimated
/// </param>
/// <returns>An object that represents a total count of objects that the cmdlet would return without paging</returns>
public PSObject NewTotalCount(UInt64 totalCount, double accuracy)
{
PSObject result = new PSObject(totalCount);
string toStringMethodBody = string.Format(
CultureInfo.CurrentCulture,
@"
$totalCount = $this.PSObject.BaseObject
switch ($this.Accuracy) {{
{{ $_ -ge 1.0 }} {{ '{0}' -f $totalCount }}
{{ $_ -le 0.0 }} {{ '{1}' -f $totalCount }}
default {{ '{2}' -f $totalCount }}
}}
",
CodeGeneration.EscapeSingleQuotedStringContent(CommandBaseStrings.PagingSupportAccurateTotalCountTemplate),
CodeGeneration.EscapeSingleQuotedStringContent(CommandBaseStrings.PagingSupportUnknownTotalCountTemplate),
CodeGeneration.EscapeSingleQuotedStringContent(CommandBaseStrings.PagingSupportEstimatedTotalCountTemplate));
PSScriptMethod toStringMethod = new PSScriptMethod("ToString", ScriptBlock.Create(toStringMethodBody));
result.Members.Add(toStringMethod);
accuracy = Math.Max(0.0, Math.Min(1.0, accuracy));
PSNoteProperty statusProperty = new PSNoteProperty("Accuracy", accuracy);
result.Members.Add(statusProperty);
return result;
}
开发者ID:40a,项目名称:PowerShell,代码行数:39,代码来源:UserFeedbackParameters.cs
示例4: Write
public override void Write(UInt64 val)
{
val = Utilities.SwapBytes(val);
base.Write(val);
if (AutoFlush) Flush();
}
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:7,代码来源:BinaryReverseWriter.cs
示例5: UInt64
public static byte[] UInt64(UInt64 i, Endianness e = Endianness.Machine)
{
byte[] bytes = BitConverter.GetBytes(i);
if (NeedsFlipping(e)) Array.Reverse(bytes);
return bytes;
}
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:8,代码来源:Pack.cs
示例6: SwapBytes
public static UInt64 SwapBytes(UInt64 x)
{
// swap adjacent 32-bit blocks
x = (x >> 32) | (x << 32);
// swap adjacent 16-bit blocks
x = ((x & 0xFFFF0000FFFF0000) >> 16) | ((x & 0x0000FFFF0000FFFF) << 16);
// swap adjacent 8-bit blocks
return ((x & 0xFF00FF00FF00FF00) >> 8) | ((x & 0x00FF00FF00FF00FF) << 8);
}
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:9,代码来源:Utilities.cs
示例7: User
public User(string login, UInt64 passwordHash, Int32 ID)
{
pLogin = login;
pPassword = new Password(passwordHash);
pID = ID;
pStaticAddressess = new List<UnifiedAddress>();
pDynamicAddressess = new List<UnifiedAddress>();
pCurrentAddress = null;
}
开发者ID:Expro,项目名称:Filechronization,代码行数:10,代码来源:User.cs
示例8: GetHammingDistance
public int GetHammingDistance(UInt64 firstValue, UInt64 secondValue)
{
UInt64 hammingBits = firstValue ^ secondValue;
int hammingValue = 0;
for (int i = 0; i < HashSize; i++) {
if (IsBitSet(hammingBits, i)) {
hammingValue += 1;
}
}
return hammingValue;
}
开发者ID:ErwinKomen,项目名称:subtiel,代码行数:11,代码来源:SimHashAnalyzer.cs
示例9: GetByteArray
/// <summary>
/// 将指定的无符号整数转换为字节数组
/// </summary>
/// <param name="value">无符号整数</param>
/// <param name="length">需要的元素个数</param>
/// <param name="maxLength">该无符号整数最多能转换的元素个数</param>
/// <returns></returns>
private static byte[] GetByteArray(UInt64 value, byte length, byte maxLength)
{
if (length < 1 || length > maxLength)
{
length = maxLength;
}
byte[] byteArray = new byte[length];
for (int i = 0; i < length; i++)
{
byteArray[i] = (byte)(value >> ((length - 1 - i) * 8));
}
return byteArray;
}
开发者ID:lyming531,项目名称:AirHome,代码行数:23,代码来源:UIntHelper.cs
示例10: GetOutputStreamAt
public IOutputStream GetOutputStreamAt(UInt64 position)
{
ThrowCloningNotSuported("GetOutputStreamAt");
return null;
}
开发者ID:noahfalk,项目名称:corefx,代码行数:5,代码来源:NetFxToWinRtStreamAdapter.cs
示例11: Seek
public void Seek(UInt64 position)
{
if (position > Int64.MaxValue)
{
ArgumentException ex = new ArgumentException(SR.IO_CannotSeekBeyondInt64MaxValue);
ex.SetErrorCode(HResults.E_INVALIDARG);
throw ex;
}
// Commented due to a reported CCRewrite bug. Should uncomment when fixed:
//Contract.EndContractBlock();
Stream str = EnsureNotDisposed();
Int64 pos = unchecked((Int64)position);
Debug.Assert(str != null);
Debug.Assert(str.CanSeek, "The underlying str is expected to support Seek, but it does not.");
Debug.Assert(0 <= pos && pos <= Int64.MaxValue, "Unexpected pos=" + pos + ".");
str.Seek(pos, SeekOrigin.Begin);
}
开发者ID:noahfalk,项目名称:corefx,代码行数:21,代码来源:NetFxToWinRtStreamAdapter.cs
示例12: HexNumberToUInt64
private unsafe static Boolean HexNumberToUInt64(ref NumberBuffer number, ref UInt64 value)
{
Int32 i = number.scale;
if (i > UINT64_PRECISION || i < number.precision)
{
return false;
}
Char* p = number.digits;
Debug.Assert(p != null, "");
UInt64 n = 0;
while (--i >= 0)
{
if (n > (0xFFFFFFFFFFFFFFFF / 16))
{
return false;
}
n *= 16;
if (*p != '\0')
{
UInt64 newN = n;
if (*p != '\0')
{
if (*p >= '0' && *p <= '9')
{
newN += (UInt64)(*p - '0');
}
else
{
if (*p >= 'A' && *p <= 'F')
{
newN += (UInt64)((*p - 'A') + 10);
}
else
{
Debug.Assert(*p >= 'a' && *p <= 'f', "");
newN += (UInt64)((*p - 'a') + 10);
}
}
p++;
}
// Detect an overflow here...
if (newN < n)
{
return false;
}
n = newN;
}
}
value = n;
return true;
}
开发者ID:nattress,项目名称:corert,代码行数:53,代码来源:FormatProvider.FormatAndParse.cs
示例13: TryParseUInt64
internal unsafe static Boolean TryParseUInt64(String s, NumberStyles style, IFormatProvider provider, out UInt64 result)
{
NumberFormatInfo info = provider == null ? NumberFormatInfo.CurrentInfo : NumberFormatInfo.GetInstance(provider);
NumberBuffer number = new NumberBuffer();
result = 0;
if (!TryStringToNumber(s, style, ref number, info, false))
{
return false;
}
if ((style & NumberStyles.AllowHexSpecifier) != 0)
{
if (!HexNumberToUInt64(ref number, ref result))
{
return false;
}
}
else
{
if (!NumberToUInt64(ref number, ref result))
{
return false;
}
}
return true;
}
开发者ID:nattress,项目名称:corert,代码行数:28,代码来源:FormatProvider.FormatAndParse.cs
示例14: NumberToUInt64
private unsafe static Boolean NumberToUInt64(ref NumberBuffer number, ref UInt64 value)
{
Int32 i = number.scale;
if (i > UINT64_PRECISION || i < number.precision || number.sign)
{
return false;
}
char* p = number.digits;
Debug.Assert(p != null, "");
UInt64 n = 0;
while (--i >= 0)
{
if (n > (0xFFFFFFFFFFFFFFFF / 10))
{
return false;
}
n *= 10;
if (*p != '\0')
{
UInt64 newN = n + (UInt64)(*p++ - '0');
// Detect an overflow here...
if (newN < n)
{
return false;
}
n = newN;
}
}
value = n;
return true;
}
开发者ID:nattress,项目名称:corert,代码行数:31,代码来源:FormatProvider.FormatAndParse.cs
示例15: VerifyUInt64ExplicitCastFromBigInteger
private static void VerifyUInt64ExplicitCastFromBigInteger(UInt64 value)
{
BigInteger bigInteger = new BigInteger(value);
VerifyUInt64ExplicitCastFromBigInteger(value, bigInteger);
}
开发者ID:er0dr1guez,项目名称:corefx,代码行数:5,代码来源:cast_from.cs
示例16: ToString
public static string ToString(UInt64 value)
{
return value.ToString(null, NumberFormatInfo.InvariantInfo);
}
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:4,代码来源:XmlConvert.cs
示例17: WriteUInt64Text
public override void WriteUInt64Text(UInt64 value)
{
int count = XmlConverter.ToChars(value, chars, 0);
if (text)
writer.WriteText(chars, 0, count);
else
writer.WriteUInt64Text(value);
signingWriter.WriteText(chars, 0, count);
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:XmlSigningNodeWriter.cs
示例18: VerifyUInt64ImplicitCastToComplex
private static void VerifyUInt64ImplicitCastToComplex(UInt64 value)
{
Complex c_cast = value;
Support.VerifyRealImaginaryProperties(c_cast, value, 0.0,
string.Format("UInt64ImplicitCast ({0})", value));
if (value != UInt64.MaxValue)
{
Complex c_cast_plus = c_cast + 1;
Support.VerifyRealImaginaryProperties(c_cast_plus, value + 1, 0.0,
string.Format("PLuS + UInt64ImplicitCast ({0})", value));
}
if (value != UInt64.MinValue)
{
Complex c_cast_minus = c_cast - 1;
Support.VerifyRealImaginaryProperties(c_cast_minus, value - 1, 0.0,
string.Format("Minus - UInt64ImplicitCast + 1 ({0})", value));
}
}
开发者ID:noahfalk,项目名称:corefx,代码行数:21,代码来源:implicitExplicitCastOperators.cs
示例19: ToString
public static string ToString(UInt64 value)
{
return value.ToString();
}
开发者ID:nguyenkien,项目名称:api,代码行数:4,代码来源:XmlConvert.cs
示例20: IsBitSet
private static bool IsBitSet(UInt64 b, int pos)
{
UInt64 iOne = 1;
return (b & (iOne << pos)) != 0;
}
开发者ID:ErwinKomen,项目名称:subtiel,代码行数:5,代码来源:SimHashAnalyzer.cs
注:本文中的UInt64类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论