本文整理汇总了C#中ScalarValue.ToLong方法的典型用法代码示例。如果您正苦于以下问题:C# ScalarValue.ToLong方法的具体用法?C# ScalarValue.ToLong怎么用?C# ScalarValue.ToLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScalarValue
的用法示例。
在下文中一共展示了ScalarValue.ToLong方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EncodeValue
public override byte[] EncodeValue(ScalarValue scalarValue)
{
long value = scalarValue.ToLong();
int size = GetUnsignedIntegerSize(value);
var encoded = new byte[size];
for (int factor = 0; factor < size; factor++)
{
encoded[size - factor - 1] = (byte) ((value >> (factor*7)) & 0x7f);
}
return encoded;
}
示例2: EncodeValue
public override byte[] EncodeValue(ScalarValue value)
{
long longValue = value.ToLong();
int size = GetSignedIntegerSize(longValue);
var encoding = new byte[size];
for (int factor = 0; factor < size; factor++)
{
int bitMask = (factor == (size - 1)) ? 0x3f : 0x7f;
encoding[size - factor - 1] = (byte) ((longValue >> (factor*7)) & bitMask);
}
// Get the sign bit from the long value and set it on the first byte
// 01000000 00000000 ... 00000000
// ^----SIGN BIT
encoding[0] |= (byte) ((0x40 & (longValue >> 57)));
return encoding;
}
示例3: EncodeValue
public override byte[] EncodeValue(ScalarValue value_Renamed)
{
return INTEGER.EncodeValue(new LongValue(value_Renamed.ToLong()));
}
示例4: ValidateValue
public override void ValidateValue(ScalarValue value)
{
if (value == null || value.IsUndefined)
return;
if (value.ToLong() > _maxValue || value.ToLong() < _minValue)
{
Global.ErrorHandler.OnError(null, DynError.IntOutOfRange, "The value {0} is out of range for type {1}",
value, this);
}
}
示例5: Equals
private bool Equals(ScalarValue otherValue)
{
return value_Renamed == otherValue.ToLong();
}
示例6: ValidateValue
public override void ValidateValue(ScalarValue value_Renamed)
{
if (value_Renamed == null || value_Renamed.Undefined)
return ;
if (value_Renamed.ToLong() > maxValue || value_Renamed.ToLong() < minValue)
{
Global.HandleError(Error.FastConstants.D2_INT_OUT_OF_RANGE, "The value " + value_Renamed + " is out of range for type " + this);
}
}
示例7: EncodeValue
public override byte[] EncodeValue(ScalarValue value)
{
return Integer.EncodeValue(new LongValue(value.ToLong()));
}