Main Site Documentation

OutputCompare.SetBlocking() and PinCapture.Read() overload?


#1

Hi,

Is it able for you to create an overload of SetBlocking and Read methods that are using ushort tables instead of uint tables? Or am I to write it by myself?
For my purpose I need only two-byte values, and converting the table from one type to another using my own method invoking Convert for each element was taking about 880ms (it should be waay shorter)…

I was using something like this:

      private void UintToUshort(uint[] uintBuffer, ushort[] ushortBuffer)
        {
            for (int i = 0; i < uintBuffer.Length; i++)
                ushortBuffer[i] = Convert.ToUInt16(uintBuffer[i].ToString());
        }

It isn’t very important case because I save these to the SD card so FEZ Domino isn’t drained from memory, but imho it’s still some waste of memory when file is twice as big with it’s second half of bytes equal to zero ;).

Or maybe there is a better solution to my issue?

Regards,
Tomasz


#2

This question does not belong in the beta forum.

Read about castling in C#. A very basic and important subject.

private void UintToUshort(uint[] uintBuffer, ushort[] ushortBuffer)
        {
            for (int i = 0; i < uintBuffer.Length; i++)
                ushortBuffer[i] = (ushort)uintBuffer[i];
        }

#3

Hmmm…
Why didn’t I think just about casting? I have no idea… ::slight_smile:

Thanks ;).

Regards,
Tomasz