125 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
114
views
Aggregate function for bit-wise OR [duplicate]
In SQL Server 2022, is there an aggregate function for doing a bit-wise OR against a particular column?
-- Example table, data and output to show the different flags
DECLARE @TEST TABLE (FLAGS TINYINT)...
7
votes
1
answer
338
views
In 6502 assembly, can I test a bit in memory without modifying the accumulator?
In 6502 assembly, I need to set the value of the Z flag according to bit 2 of the value at address 8000ドル. But I need to do so without overwriting the value in the A register.
I've come up with this ...
1
vote
1
answer
97
views
Rust trait inheritance for a subset of the trait implementations
I'm not sure how exactly to formulate this question so I will illustrate by example.
I am using the bitflags crate which provides a trait called Flags. The flags trait involves the presence of an ...
2
votes
1
answer
76
views
Can return value of fetestexcept contain multiple flags?
Can the result of std::fetestexcept return multiple bits set, or does it only ever return a single bit?
Dess's user avatar
- 2,739
2
votes
2
answers
101
views
Why does jump if carry not work after IRET
I'm a beginner in learning 8086 assembly language using DOSBox. I'm using int 21h function 3Dh to open a data file, and I wanted to carry out the code using the file handle if the file is opened ...
0
votes
1
answer
78
views
One liner for operation with two different operators
I have a bitflag enum EFlags. Given a condition I want to either remove a flag or add a flag. I have defined the operator |= to add a flag and &= to remove a flag. For example, let us say the ...
1
vote
2
answers
104
views
Is it possible to check for exactly n flags are set for an enum in C++ std::unordered_map key?
I am setting up an unordered_map, in which the key is an enum of Direction defined as:
enum Direction : uint16_t {
North = 1 << 0,
East = 1 << 2,
South = 1 << 3,
West ...
1
vote
1
answer
691
views
Deserializing a bitflag enum in C# with Unity
I have a unity project. Using the stock json tools at my disposal, i'm trying to deserialize an enum that uses bit flags (ie something like)
[Flags]
enum Terrain
{
NORMAL = 0,
FOREST = 1,
SWAMP ...
0
votes
1
answer
106
views
Checking for multiple bitflags - binary comparison in [PHP]
Checking for multiple flags.
I just want to know if there is another way to check for multiple flags, different from &&?
class DemoClass
{
public const MY_FLAG1 = 0b1; // 0001 // 1
...
3
votes
1
answer
1k
views
Why are only 128 characters encoded to one byte in UTF-8 and not 256 characters?
I'm trying to grasp UTF-8 encoding. The encoding of code points can range from 1 to 4 bytes. There are only 128 characters which encode to one byte. But since a byte has 8 bits it could encode 256(=28)...
4
votes
3
answers
151
views
Testing bitmask when stored as integer and available as string
I have a bitmask (really a 'flagmask') of integer values (1, 2, 4, 8, 16 etc.) which apply to a field and I need to store this in a (text) log file. What I effectively store is something like "x=...
2
votes
2
answers
844
views
Can I decompose a Python Flag enum into its fundamental parts?
I have an enum that represents the directions you're allowed to move for a given cell in a maze:
class Direction(Flag):
NORTH = 1
EAST = 2
SOUTH = 4
WEST = 8
NE = NORTH | EAST
...
1
vote
1
answer
171
views
Why cout.flags() & std::ios_base::right prints 0 even though by default the output is right aligned
I am learning C++'s iostream. In particular, I have learnt that by default the output of cout is right aligned. For example, if I write:
#include <iostream>
#include <iomanip>
int main()
{
...
user avatar
user19946454
0
votes
1
answer
135
views
Determine if flag value is valid
I have a Number value I'm sending to an API and I want to soft check on the front end if the value is a valid "flag" before shipping it off.
So far as I can figure, a flag is any number ...
-1
votes
1
answer
122
views
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(/*...