Re: [w3c/IndexedDB] Rework key generator algorithm (#153)

Thanks @brettz9 !

Yes, I missed both the floor() step _and_ incrementing. :( 

I've hopefully corrected the steps, and made a note about where the limit comes from, although I didn't go into "what if..." detail. 

Re: altering the maximum:

We already have tests around the boundary condition and that the generator may produce 9007199254740992 so I don't think we want to reduce that. In a pure JS implementation I scraped together to sanity check my logic, I used e.g.:
```js
    this.current += 1;
    if (this.current === key)
      this.current = Infinity;
```
and
```js
    if (value >= this.current) {
      this.current = value + 1;
      if (this.current === value)
        this.current = Infinity;
    }
```
An implementation using `double`s could do that as well. I expect most implementations use an `int64` or `uint64` internally and can use the increment beyond 9007199254740992 safely.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/pull/153#issuecomment-281792106

Received on Wednesday, 22 February 2017 20:27:08 UTC