mirror of https://github.com/vacp2p/nim-libp2p.git
make `isLiteral` compatible with ARC and ORC
This commit is contained in:
parent
1681197d67
commit
2d4dad0716
|
@ -37,10 +37,13 @@ proc len*(vb: VBuffer): int =
|
||||||
doAssert(result >= 0)
|
doAssert(result >= 0)
|
||||||
|
|
||||||
proc isLiteral[T](s: seq[T]): bool {.inline.} =
|
proc isLiteral[T](s: seq[T]): bool {.inline.} =
|
||||||
type
|
when defined(gcOrc) or defined(gcArc):
|
||||||
SeqHeader = object
|
false
|
||||||
length, reserved: int
|
else:
|
||||||
(cast[ptr SeqHeader](s).reserved and (1 shl (sizeof(int) * 8 - 2))) != 0
|
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 =
|
proc initVBuffer*(data: seq[byte], offset = 0): VBuffer =
|
||||||
## Initialize VBuffer with shallow copy of ``data``.
|
## Initialize VBuffer with shallow copy of ``data``.
|
||||||
|
|
Loading…
Reference in New Issue