Questions tagged [bitmask]

Bitmask is a technique used to isolate specific bits in a byte in order to work only on the desired ones. They are used in IP addresses to separate the network prefix and the host number for example.

738 questions
0
votes
2 answers

Wireshark dissector UINT64 bitmasking

I see that the bitmask field in the header_field used in proto_register_field_array(const int parent, hf_register_info *hf, const int num_records); is a guint32, therefor I cannot use a 64 bit mask. Is there anyway I can go around? Specifically, I…
gigashock
  • 3
  • 2
0
votes
0 answers

Using Bit Mask of 32 bits for a string

Is there any simple function that can be used in the server which can bit mask ( 32 Bit) a hexadecimal or normal character string? For example: If I have a string called 'Apple'. Can I bit mask it (32 bit) ? What should be the approach?
0
votes
1 answer

PHP passing in or'd parameters (bitmask) into a function

I have a function in php: function renden(array $additional_css_files = array(), $load_js = true, $load_keen = false, $allow_robots = false, $generate_csrf = true) { } It is becoming really nasty to specific all the optional parameters each time.…
Justin
  • 42,716
  • 77
  • 201
  • 296
0
votes
2 answers

How to use bitmask in c++?

I'm tryin to mask an address in c++. This is what i've tried. INT32 * myaddr = (INT32*)addr; // This converted 'addr' to the hexadecimal format -- 'myaddr' Now how do I and it 0xff00 ? UINT32 sec_addr = (myaddr & 0xff); When I try to do the…
pistal
  • 2,310
  • 13
  • 41
  • 65
0
votes
1 answer

get coordinates of a pixel in bitmask

i have a bitmask in c++ with text on it. The bitmask gives me a value of 255 for pixels that have no text covering it. I would like to get coordinates (x,y) of any pixel or group of pixels with this value. What process should i follow? This could be…
0
votes
2 answers

C++ bitmask / conditional branch optimization

I am trying to reduce the execution time of the if-statement shown below (second block of code). It involves a bit-mask where the masks array contain 8 integers used as masks and setup as follows: static unsigned int masks[8]; void setupMasks() { …
PentiumPro200
  • 641
  • 7
  • 23
0
votes
1 answer

Representing a multiset as a sequence of bits

We can use a bitmask to represent set presence in a finite (or at least indexed) domain efficiently, for instance to represent the letters in car we could represent this in a 26-bit set like…
dimo414
  • 47,227
  • 18
  • 148
  • 244
0
votes
1 answer

Do OR with all array's members

Suppose I have an array [1,2,3,4], and I want to do 1 | 2 | 3 | 4 in Ruby language How to write it faster? Actually, I just read an article about bitmask at CoderWall and I wonder when the settings have many options, such as 10 or 15, I think write…
yeuem1vannam
  • 957
  • 1
  • 7
  • 15
0
votes
1 answer

Django - Template bitmask check

Consider this list: options = [ { 'name': 'Option 1', 'plan': 0b001, }, { 'name': 'Option 2', 'plan': 0b010, }, { 'name': 'Option 3', 'plan': 0b110, }, ] Question: How can I…
0
votes
2 answers

Cryptography - Good to swip some bits in byte array?

I currently informed myself about encryption a lot. And I wonder, whether it would be good to toggle some bits (XOR and bitmasks) at a known position in the encrypted byte array and to toggle them again before decrypting them. Because even if you…
MinecraftShamrock
  • 3,504
  • 2
  • 25
  • 44
0
votes
3 answers

How to generate every bitmask of X length in javascript

I am wanting to create an array of bitmasks of X length and am looking for an efficient function. For length 3 I would like it to generate: 000, 001, 010, 011, 100, 101, 110, 111 I am looking for a solution that uses bit math to do so - right now I…
cyberwombat
  • 38,105
  • 35
  • 175
  • 251
0
votes
1 answer

bit masks on SQLite

I saw across this site questions similar to this one and the answers were usually not to use bit masks. One of the strongest reasons not to do that was that it even won't save memory because the SQL server wrapped bit columns to a single…
user1908466
  • 503
  • 1
  • 8
  • 17
0
votes
2 answers

efficient way to split ONE bitstream according to many masks?

I am experimenting to make a Inverse Multiplexer, which could split one bitstream into many according to some masks. Here's the idea example This is a 24 bit stream, each letter represents 1 bit: abcdefgh ijklmnop qrstuvwx Given three masks, every…
est
  • 11,429
  • 14
  • 70
  • 118
0
votes
1 answer

Trying to understand the workings of com.adobe.net.URIEncodingBitmap

I'm examining the URIEncodingBitmap class of the com.adobe.net package, and I'm having a hard time understanding the internal workings, exactly. Here's the code: package com.adobe.net { import flash.utils.ByteArray; /** * This class…
Decent Dabbler
  • 22,532
  • 8
  • 74
  • 106
0
votes
1 answer

Pygame level bitmask checking optimisation?

Pygame offers a pretty neat bitmask colliding function for sprites, but it's really slow when you are comparing large images. I've got my level image, which worked fine when it was 400x240, but when I changed the resolution to (a lot) bigger,…
MrLog
  • 45
  • 1
  • 6