Hi! Initially I create a register array and then calculate it, now, I want to re allocate it as all 0. Maybe the fastest way is using memset? But note that this is float4! How to use memset here? Thank you!!!
the 2nd argument of memset always takes a char. What you want is
memset(c, 0, 8*2*sizeof(float4));
sizeof(c) will be identical to 8*2*sizeof(float4) and should be used instead.
Generally you cannot initialize an array of floats with a desired float value using memset unless the desired value is 0. A float value of 0.0f corresponds to a sequence of 4 null bytes. The workaround for other values is to use a for loop and setting the array elements to the desired value.