From 8005318ee4fbf8cef726b1af2015e76aaf1e700a Mon Sep 17 00:00:00 2001 From: AmjadHD Date: Mon, 3 Oct 2022 16:03:04 +0100 Subject: [PATCH] Revert "Remove `SomeInteger` overload" This reverts commit 79a2963a2154377ee44e9ad5532409baaf5575a6. --- lib/pure/base64.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pure/base64.nim b/lib/pure/base64.nim index 81bfb3f39e..bff54ca5e7 100644 --- a/lib/pure/base64.nim +++ b/lib/pure/base64.nim @@ -31,7 +31,7 @@ runnableExamples: ## runnableExamples: - let encodedInts = encode([1'u8,2,3]) + let encodedInts = encode([1,2,3]) assert encodedInts == "AQID" let encodedChars = encode(['h','e','y']) assert encodedChars == "aGV5" @@ -143,7 +143,7 @@ template encodeImpl() {.dirty.} = let lookupTable = if safe: unsafeAddr(cb64safe) else: unsafeAddr(cb64) encodeInternal(s, lookupTable) -proc encode*[T: byte|char](s: openArray[T], safe = false): string = +proc encode*[T: SomeInteger|char](s: openArray[T], safe = false): string = ## Encodes `s` into base64 representation. ## ## If `safe` is `true` then it will encode using the @@ -158,7 +158,7 @@ proc encode*[T: byte|char](s: openArray[T], safe = false): string = assert encode("Hello World") == "SGVsbG8gV29ybGQ=" assert encode(['n', 'i', 'm']) == "bmlt" assert encode(@['n', 'i', 'm']) == "bmlt" - assert encode([1'u8, 2, 3, 4, 5]) == "AQIDBAU=" + assert encode([1, 2, 3, 4, 5]) == "AQIDBAU=" encodeImpl() proc encode*[T: SomeInteger and not byte](s: openArray[T], safe = false): string =