Questions tagged [bit-masks]

bitmasks are data used for bitwise operations.

54 questions
0
votes
0 answers

When the integers got upset

I have been stuck with this problem for quite large time. https://www.hackerearth.com/code-monk-bit-manipulation/algorithm/when-the-integers-got-upset/. In short what is says is: There are two arrays A and P of length N. There is a third array Z…
Walter
  • 41
  • 1
  • 5
0
votes
2 answers

What should my constant mask value be for radix sort?

I was given a problem for one of my CS courses where I have to program a LSD radix sort that can sort unsigned integers (+ or -). It is given that the values to be sorted are 32-bit integer values. The stipulation is that my mask must be a constant…
0
votes
1 answer

Using bitmasks with iOS to send and receive data

I am working on a project where one of the requirements is to send and receive data using bitmasks. I have 12 bits (12 pieces of data) that I have to transmit the status of. I have an elementary understanding of bitmasks. Does anyone have a good…
Brian Kalski
  • 897
  • 9
  • 35
0
votes
1 answer

What is the maximum integer it is safe to use in a Javascript bitmask flag value?

This is mostly just a sanity-check. Mozilla says that The operands of all bitwise operators are converted to signed 32-bit integers in two's complement format. and that The numbers -2147483648 and 2147483647 are the minimum and the maximum …
Brian Rak
  • 4,912
  • 6
  • 34
  • 44
0
votes
0 answers

Check that a bitmask flag is zero

I'm getting data from a server. The first bit indicates whether a message was read or not read: 1 for "read" and 0 for "not read". The second bit says whether the message was edited or not. So I'm trying to read the statuses: typedef…
Maria
  • 755
  • 1
  • 11
  • 29
0
votes
3 answers

Setting bitmask enum declared in objective-c from swift

I'm trying to use Parse SDK for iOS in my new project. It has viewController with enum property; typedef enum { PFLogInFieldsNone = 0, PFLogInFieldsUsernameAndPassword = 1 << 0, PFLogInFieldsPasswordForgotten = 1 << 1, …
Vitalii Boiarskyi
  • 1,363
  • 2
  • 10
  • 25
0
votes
1 answer

iOS how to combine more than one option when writing NSData to file?

I have the following method of saving file data with more than one option. I want to combine NSDataWritingAtomic with NSDataWritingFileProtectionComplete. Should I use the | symbol to combine two options when writing NSData? The reason why I'm…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
0
votes
5 answers

Best method to find out set bit positions in a bit mask in C

What would be the best way to identify all the set bit positions in a 64 bit bitmask. Suppose my bit mask is 0xDeadBeefDeadBeef, then what is the best way, to identify all the bit positions of the set bits in it. long long bit_mask =…
Viks
  • 760
  • 4
  • 12
  • 26
-3
votes
1 answer

How to track multiple collisions between 2 sprites?

Here's an example, just for ease of understanding: Sprite A is a ball. Sprite B is a cube. When the ball touches the cube once, I want the label to say first contact. When the same ball touches the same cube again, I want the label to say…
1 2 3
4