[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] comparing typed arrays

On Mon, Jun 11, 2012 at 11:30 AM, Joshua Bell <jsbell@chromium.org> wrote:
For handling arbitrary encoded string terminators we discussed exposing memchr() on views (as an indexOf() method) over on whatwg. Any other mem* primitives that we should consider?

I think memchr (+ memrchr) and memcmp is it.  We already have memset and memcpy (TypedArray#set), and that covers all of the important ones.

memchr and memrchr should be indexOf/lastIndexOf functions on TypedArray (eg. Uint16Array#indexOf(0) to find a null-terminator in a UTF-16 string), but memcmp can probably just work on the raw underlying data (like memcmp itself--avoiding the complexity of crossing types) and live on ArrayBufferView.

Glenn Maynard