C # Set equivalent method in Objective-C

I am transferring a small function from C # to Objective-C (for iPhone) and I am confused about the C # method.

I'm not sure if the following C # lines will be equal in Objective C. In particular, 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 an idea that Set in C # can be equated to Objective-C. Of course, I did a few googling, but nothing came of it.

Cheers, Brett

+4
source share
2 answers

You seem to be looking for a way to implement bitmaps in Objective-C. There is an answer to this question: How to implement a bit array in C / Objective C.

Regarding the Set method, the documentation for this is here: http://msdn.microsoft.com/en-us/library/system.collections.bitarray.set.aspx . Everything that he does sets a bit in a given index (in this case j ) with a Boolean value (in this case, the result of comparing inequality).

+4
source

Based on a very brief search, it seems that BitArray is not a natural part of Objective C. So, first tell us what you are trying to use instead of C # BitArray.

This question may help: How to implement a bit array in C / Objective C

0
source

Source: https://habr.com/ru/post/1401630/


All Articles