Operations on streams can be very cool too ( and subject to massive optimizations using MMX, 3DNow, SSE, SSE2, SSE3, etc ).
1 2 3 4 5 6
| void add( int value, int[] stream, int offset, int length ); void mul( float factor, float[] stream, int offset, int length ); void xor( short mask, short[] stream, int offset, int length ); void lshift( int amount, int[] stream, int offset, int length ); void clamp( byte lbound, byte ubound, byte[] stream, int offset, int length ); ... |
Ah yes, the wonderful MMX, where 1*1 = 0.5
I would love to be able to use SIMD from java, though.