mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
@@ -429,13 +429,13 @@ proc opConv(c: PCtx; dest: var TFullReg, src: TFullReg, desttyp, srctyp: PType):
|
||||
return true
|
||||
of tyUInt..tyUInt64:
|
||||
dest.ensureKind(rkInt)
|
||||
case skipTypes(srctyp, abstractRange).kind
|
||||
let styp = srctyp.skipTypes(abstractRange) # skip distinct types(dest type could do this too if needed)
|
||||
case styp.kind
|
||||
of tyFloat..tyFloat64:
|
||||
dest.intVal = int(src.floatVal)
|
||||
else:
|
||||
let srcDist = (sizeof(src.intVal) - srctyp.size) * 8
|
||||
let srcDist = (sizeof(src.intVal) - styp.size) * 8
|
||||
let destDist = (sizeof(dest.intVal) - desttyp.size) * 8
|
||||
|
||||
var value = cast[BiggestUInt](src.intVal)
|
||||
value = (value shl srcDist) shr srcDist
|
||||
value = (value shl destDist) shr destDist
|
||||
|
||||
@@ -65,3 +65,17 @@ block t9322:
|
||||
proc mystr(s: string) =
|
||||
echo s
|
||||
mystr($Fix("apr"))
|
||||
|
||||
|
||||
block: # bug #13517
|
||||
type MyUint64 = distinct uint64
|
||||
|
||||
proc `==`(a: MyUint64, b: uint64): bool = uint64(a) == b
|
||||
|
||||
block:
|
||||
doAssert MyUint64.high is MyUint64
|
||||
doAssert MyUint64.high == 18446744073709551615'u64
|
||||
|
||||
static:
|
||||
doAssert MyUint64.high is MyUint64
|
||||
doAssert MyUint64.high == 18446744073709551615'u64
|
||||
|
||||
Reference in New Issue
Block a user