make `isLiteral` compatible with ARC and ORC

This commit is contained in:
narimiran 2021-06-30 16:08:06 +02:00
parent 1681197d67
commit 2d4dad0716
1 changed files with 7 additions and 4 deletions

View File

@ -37,10 +37,13 @@ proc len*(vb: VBuffer): int =
doAssert(result >= 0)
proc isLiteral[T](s: seq[T]): bool {.inline.} =
type
SeqHeader = object
length, reserved: int
(cast[ptr SeqHeader](s).reserved and (1 shl (sizeof(int) * 8 - 2))) != 0
when defined(gcOrc) or defined(gcArc):
false
else:
type
SeqHeader = object
length, reserved: int
(cast[ptr SeqHeader](s).reserved and (1 shl (sizeof(int) * 8 - 2))) != 0
proc initVBuffer*(data: seq[byte], offset = 0): VBuffer =
## Initialize VBuffer with shallow copy of ``data``.