From 5a80838fc15399251681869e9b36bd818d68a582 Mon Sep 17 00:00:00 2001 From: Patrick Chilton Date: Tue, 4 May 2021 20:38:41 +0200 Subject: [PATCH] Add iterator to TypeScript typing --- TypedFastBitSet.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TypedFastBitSet.d.ts b/TypedFastBitSet.d.ts index cedd828..90c29e2 100644 --- a/TypedFastBitSet.d.ts +++ b/TypedFastBitSet.d.ts @@ -57,9 +57,12 @@ declare class TypedFastBitSet { /** If the value was not in the set, add it, otherwise remove it (flip bit at `index`) */ flip(index: number): void; - /** Return an array with the set bit locations (values) */ + /** Call a function with the set bit locations (values) */ forEach(fnc: (index: number) => void): void; + /** Iterate over the set bit locations */ + *[Symbol.iterator](): IterableIterator[number]; + /** fast function to compute the Hamming weight of a 32-bit unsigned integer */ hammingWeight(v: number): number;