Questions tagged [bitflags]

the use of individual bits in a byte (or a set of bytes) to represent boolean values.

119 questions
0
votes
1 answer

SET, Bridge Table, Multiple bit Columns -- Which is the best way to store complex ratings to MySQL?

Situation I am trying to figure out a rating system right now that contains ratings for servers by players. A user would be able to rate a server in several different categories. Maintainability, performance, and compactness of the storage of the…
Pangamma
  • 731
  • 12
  • 28
0
votes
3 answers

Optimize bitflag check

How can I optimize the following code? ( (kbd_flags & KBD_FLAG_SHIFT) && !(kbd_flags & KBD_FLAG_CAPS)) || (!(kbd_flags & KBD_FLAG_SHIFT) && (kbd_flags & KBD_FLAG_CAPS)) Basically, I want to check if either KBD_FLAG_SHIFT or KBD_FLAG_CAPS is…
watain
  • 4,838
  • 4
  • 34
  • 35
0
votes
1 answer

PHP Inotify - Determine Bit Mask from Integer Value

I'm working on a file monitoring daemon written in PHP, using the inotify PECL extension. I've nearly got it finished, as in it tells me when an inotify event happens. The return value of inotify_read($fd) is an array that looks like this: Array ( …
Goldentoa11
  • 1,700
  • 2
  • 17
  • 29
0
votes
1 answer

jQuery bitwise element selection

Perhaps I'm think about this the wrong way, but I'm trying to fade out some html elements on my page depending on the flags selected via check-boxes on the same page. I have many
on the page. Each of these bar divs will have an…
ETFairfax
  • 3,794
  • 8
  • 40
  • 58
0
votes
1 answer

How to use Bit flags in mysql

I am using binary bits flags in a mysql to determine the role of a person. The person can be either faculty, instructor or both. Each academy has one or more unique faculty person (one-to-many relation). Also each academy has an instructor person.…
Code_Ed_Student
  • 1,180
  • 6
  • 27
  • 67
0
votes
0 answers

Required Permissions C# Attribute doesn't appear to work with bitwise or

// [RequiredPermission(Permissions.ProjectManagement | Permissions.UserManagement)] //doesn't work // [RequiredPermission(Permissions.UserManagement)] //works [RequiredPermission(Permissions.ProjectManagement)] //works public ActionResult Index()…
allencoded
  • 7,015
  • 17
  • 72
  • 126
0
votes
2 answers

Bit flags always including 0 value

So I came accross this code: [Flags] public enum Options { NA = 0, OptionA = 1, OptionB = 2, OptionC = 4 } Now, technically 'NA' is invalid, if the user doesn't want to select any Options, they just wont select any, and it will get…
RJP
  • 4,016
  • 5
  • 29
  • 42
0
votes
2 answers

What are possible ways of converting these bitmask definitions from pawn language to PHP?

Well, to clarify, pawn is a language that is pretty similar to C++. I'm programming an Admin Control Panel that requires bit mask permissions (in php) and I actually don't know if I converted the permissions properly (since it's something I have…
0
votes
3 answers

Bit flags from boolean variables in Java and MySQL

I just want to create a bit flag from a series of boolean variables so I can store one variable in a MySQL database instead of several booleans. For example, I have three boolean flags (A, B, C) and want to create a single bit flag based on the…
John Smith
  • 363
  • 3
  • 13
-1
votes
1 answer

How C++ represents state flags related to the order of operations?

I am now working on a motion control system. I want to make the motion control interface more flexible, so I want to provide an api that can specifiy the controlled axis. It just like. void moveTo(/*data*/, Axis which); Axis parameter is used to…
-1
votes
1 answer

C bit flags cant be unset

I am trying to implement my own use of bit flags in C/C++. I have three functions: getBool, setBool, and printBools. All of my current code except one part: I can't set bits to false. They set to true just fine, they read back just fine, but I can't…
DarkSun
  • 1
  • 1
-1
votes
2 answers

bitwise flags get set arbitrarily

I've only been studying C++ (and programming for that matter) for a week, so the question may lack the understanding of fundamental programming principles, but here goes nothing: unsigned int bitFlags() { unsigned char option1 = 0x01; // hex for…
Anon
  • 109
  • 1
  • 8
-1
votes
1 answer

Python: Setting Multiple Attributes for a file (e.g. System, Hidden)

What is the way to set multiple file-attributes using Python? E.g. I want to set a file's attribute to System, Hidden. I can use something like below, but it will just set just one attributes, and overwrite the previous write: import win32con,…
Imagine
  • 85
  • 1
  • 10
-2
votes
1 answer

Transform byte flags in error status codes to int

I'm confused in bitmasks, bitflags, and other "bit" stuff. I have a list of error codes - like [102, 104, 108, 80000000, 8000000, 10000000, 1000000, 0x0008000, ....]. Part of it writing in system logs like bitflags, f.e. "67108864" (and part of them…
Pruntoff
  • 615
  • 3
  • 8
  • 18
1 2 3 4 5 6 7
8