the use of individual bits in a byte (or a set of bytes) to represent boolean values.
Questions tagged [bitflags]
119 questions
0
votes
1 answer
CreateFile - dwDesiredAccess
As said here Microsoft docs - CreateFileA function
dwDesiredAccess
The requested access to the file or device, which can be summarized as
read, write, both or neither zero).
The most commonly used values are GENERIC_READ, GENERIC_WRITE, or both
…

ElayM
- 66
- 1
- 7
0
votes
2 answers
Compact non-repetitive way for an ALL flag in enums that represent bitflags in C++
I often use enums for bitflags like the following
enum EventType {
NODE_ADDED = 1 << 0,
NODE_DELETED = 1 << 1,
LINK_ADDED = 1 << 2,
LINK_DELETED = 1 << 3,
IN_PIN_ADDED = 1 << 4,
IN_PIN_DELETED = 1 << 5,
IN_PIN_CHANGE = 1…

Philipp Mildenberger
- 438
- 5
- 11
0
votes
2 answers
How to make [Flags] enum and switch case work together?
How to make [Flags] enum and switch case work together? Very desirable to make it looks simple. Similar Questions asked many times, but never directly to [Flags] enum.
If M1 set execute operation 1,
if M2 set execute operation2 ,
if BOTH M1 and…

justromagod
- 933
- 9
- 20
0
votes
2 answers
Bit Manipulation and Flags
https://i.stack.imgur.com/pteDe.png
A:
When the man page for open says:
The flags specified are formed by or'ing the following values:
O_RDONLY open for reading only
O_WRONLY open for writing only
...
it means…

heskin reaper
- 21
- 1
- 4
0
votes
1 answer
Motorola 68k: Understanding the status registrer flag states
I'm having trouble understanding how exactly the Status Register (SR) content works.
Let's say that the content of (SR) = $0300. How would I figure out in which states the flags are?
Of course that would also answer the question, if the flags…

Dominik Car
- 191
- 1
- 8
0
votes
1 answer
Bit-Flag for decimal 8 in File Attribute
This site gives a overview of file-flags currently in use. I miss the value 8 in the table.
FILE_ATTRIBUTE_ARCHIVE 32 (0x20)
FILE_ATTRIBUTE_COMPRESSED 2048 (0x800)
FILE_ATTRIBUTE_DEVICE 64 (0x40)
FILE_ATTRIBUTE_DIRECTORY 16…

Grim
- 1,938
- 10
- 56
- 123
0
votes
2 answers
Gmod Lua - Checking if flag exists in bitflag
I am trying to check if a key is being pressed at the current frame in Gmod Lua with cmd:GetButtons().
In other words, I am trying to see if a flag exists in a bitflag in Lua.
I am attempting the following code:
-- flags = 1024 (when holding…

Ari Seyhun
- 11,506
- 16
- 62
- 109
0
votes
2 answers
Most efficient way to check if flags are set in an integer
I have 11 flags defined as:
#define F1 1
#define F2 2
#define F3 3
#define F4 4
...
#define F11 11
In some function I then create an integer which can include either of those flags, for example:
int a = (1 << F1) | (1 << F5) | (1 << F11) | (1 <<…

user1806687
- 934
- 1
- 10
- 27
0
votes
0 answers
What are the flag by flag permissions required for userAccountControl ADSI property?
I have a situation where I'd like to use PowerShell in an environment without Get-ADUser to determine whether another account is expired. Someone else in the domain is able to read the userAccountControl property off of the object returned from an…

Code Jockey
- 6,611
- 6
- 33
- 45
0
votes
1 answer
Okay to add non-power of 2 values to enum with flags?
In my enum below, my intention is to be able to use Scheduled to mean 'ILT | VILT | HVILT'. In the guidelines for making this kind of enum everyone suggests using powers of 2, obviously, but if I actually mean Scheduled to be a combination of those…

BVernon
- 3,205
- 5
- 28
- 64
0
votes
1 answer
.NET Enum and BitFlags
I’m using [Enum] as part of a list for special template in my pages..
Enum SMARTTAGS As Long
ITEM01 = 1 << 1
ITEM02 = 1 << 2
ITEM03 = 1 << 3
ITEM04 = 1 << 4
ITEM05 = 1 << 5
…
ITEM31 = 1 << 31
ITEM32 = 1 << 32
ITEM33 = 1 << 33
…

Frederic
- 367
- 5
- 11
0
votes
1 answer
Expand bit fields to multiple rows (kinda join)
let's say I have a table like this:
CREATE TABLE [dbo].[Scheduler](
[DayOfWeek] [tinyint] NOT NULL,
[Time] [time](0) NOT NULL,
[Action] [varchar](255) NOT NULL
)
And some data, like this:
INSERT INTO Scheduler VALUES (1, '11:00:00',…

navossoc
- 556
- 1
- 6
- 16
0
votes
1 answer
How to get list of printers not printing direct?
I need a list of printers that DO NOT print direct. Getting a list that do print direct seems reasonably easy. But how to do the opposite?
Dim PrintServer As New SysPrint.PrintServer
Dim arrFlags(0) As SysPrint.EnumeratedPrintQueueTypes
…

D_Bester
- 5,723
- 5
- 35
- 77
0
votes
2 answers
C# Enum Flags - roles edit, view, admin
I define my roles like this:
[Flags]
public enum Roles : byte
{
View = 1,
Edit = 2,
Admin = (View | Edit)
}
View role, can view only
Edit can view and edit only
Admin can do Admin stuff, edit and view
Am I doing…

user2818430
- 5,853
- 21
- 82
- 148
0
votes
3 answers
Checking UInt16 for flags using Enum.HasFlag()?
I have a C#/.NET 4.0 application that receives and parses some data from a network connection. One particular piece of data that I need to parse is a UInt16 value that represents a set of flags. I've defined an enum that represents these flags…

bmt22033
- 6,880
- 14
- 69
- 98