I am porting a small function from C# to Objective-C (for the iPhone), and I am running into a snag with a C# method.
I’m not sure what the following C# lines would equate to in Objective C. Particularly the Set Method.
BitArray bits = new BitArray(DESC_LEN);
bits.Set(j,
(ii_data[cix_1 - KERNEL_SZ/2*ii_step - KERNEL_SZ/2] +
ii_data[cix_1 + KERNEL_SZ/2*ii_step + KERNEL_SZ/2] -
ii_data[cix_1 - KERNEL_SZ/2*ii_step + KERNEL_SZ/2] -
ii_data[cix_1 + KERNEL_SZ/2*ii_step - KERNEL_SZ/2])
>
(ii_data[cix_2 - KERNEL_SZ/2*ii_step - KERNEL_SZ/2] +
ii_data[cix_2 + KERNEL_SZ/2*ii_step + KERNEL_SZ/2] -
ii_data[cix_2 - KERNEL_SZ/2*ii_step + KERNEL_SZ/2] -
ii_data[cix_2 + KERNEL_SZ/2*ii_step - KERNEL_SZ/2] )
);
Does anyone have any idea what Set in C# might equate to in Objective-C. Of course I’ve done some Googling, but nothing pops out.
Cheers,
Brett
It seems you’re looking for a way to implement bit arrays in Objective-C. There is an answer to that question here: How do I implement a bit array in C / Objective C.
As for what the
Setmethod does, the documentation for that is here: http://msdn.microsoft.com/en-us/library/system.collections.bitarray.set.aspx. All it does is set the bit at the given index (in this casej) with a boolean value (in this case, the result of the inequality comparison).