From a79790c6ed36cba43a0c21d103c64a190d19bffc Mon Sep 17 00:00:00 2001 From: Antonis Geralis Date: Fri, 9 Sep 2022 20:57:44 +0300 Subject: [PATCH] alternatively promote ref/seq to sizeof(T) --- drchaos/mutator.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drchaos/mutator.nim b/drchaos/mutator.nim index a91aab6..7a0612f 100644 --- a/drchaos/mutator.nim +++ b/drchaos/mutator.nim @@ -282,10 +282,10 @@ proc sample[T: SomeNumber](x: T; s: var Sampler; r: var Rand; res: var int) = sampleAttempt(attempt(s, r, DefaultMutateWeight*sizeof(x), res)) proc sample[T](x: seq[T]; s: var Sampler; r: var Rand; res: var int) = - sampleAttempt(attempt(s, r, DefaultMutateWeight*sizeof(x), res)) + sampleAttempt(attempt(s, r, DefaultMutateWeight*sizeof(pointer), res)) proc sample(x: string; s: var Sampler; r: var Rand; res: var int) = - sampleAttempt(attempt(s, r, DefaultMutateWeight*sizeof(x), res)) + sampleAttempt(attempt(s, r, DefaultMutateWeight*sizeof(pointer), res)) proc sample[T: tuple|object](x: T; s: var Sampler; r: var Rand; res: var int) = when compiles(mutate(x, 0, false, r)):