From 97cf1841190277ed985d1ead88e7712aaf0f3f74 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Thu, 14 Jul 2022 16:05:55 +0300 Subject: [PATCH] Rename some definitions to avoid clashes with stew/bitops2 --- json_serialization/reader.nim | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/json_serialization/reader.nim b/json_serialization/reader.nim index 7fd3226..00d7f6e 100644 --- a/json_serialization/reader.nim +++ b/json_serialization/reader.nim @@ -405,7 +405,7 @@ func totalExpectedFields*(T: type): int {.compileTime.} = if isFieldExpected(FieldType): inc result -func setBit*(x: var uint, bit: int) {.inline.} = +func setBitInWord(x: var uint, bit: int) {.inline.} = let mask = uint(1) shl bit x = x or mask @@ -425,16 +425,16 @@ func expectedFieldsBitmask*(TT: type): auto {.compileTime.} = var i = 0 enumAllSerializedFields(T): if isFieldExpected(FieldType): - res[i div bitsPerWord].setBit(i mod bitsPerWord) + res[i div bitsPerWord].setBitInWord(i mod bitsPerWord) inc i return res -template setBit[N](data: var array[N, uint], bitIdx: int) = - when N > 1: - data[bitIdx div bitsPerWord].setBit(bitIdx mod bitsPerWord) +template setBitInArray[N](data: var array[N, uint], bitIdx: int) = + when data.len > 1: + setBitInWord(data[bitIdx div bitsPerWord], bitIdx mod bitsPerWord) else: - data[0].setBit(bitIdx) + setBitInWord(data[0], bitIdx) func isBitwiseSubsetOf[N](lhs, rhs: array[N, uint]): bool = for i in low(lhs) .. high(lhs): @@ -643,7 +643,7 @@ proc readValue*[T](r: var JsonReader, value: var T) r.lexer.next() r.skipToken tkColon reader(value, r) - encounteredFields.setBit(fieldIdx) + encounteredFields.setBitInArray(fieldIdx) elif r.allowUnknownFields: r.lexer.next() r.skipToken tkColon