UKismetMathLibrary::Xor_IntInt
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Bitwise XOR of two integers (A ^ B). Commonly used to toggle specific flag bits without affecting others.
Caveats & Gotchas
- • XOR-ing a value with itself always yields 0 — this is a valid idiom to clear a register in assembly but rarely the intent in gameplay code; make sure B is a mask constant, not the same variable as A.
- • Blueprint's compact node title is '^', which is the C++ XOR operator — not the power operator as in some other languages. New users sometimes confuse this with exponentiation.
Signature
static UE_INL_API int32 Xor_IntInt(int32 A, int32 B); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | int32 | First operand. | — |
| B | int32 | Second operand. | — |
Return Type
int32 Example
Toggle a flag bit C++
// Toggle the stealth flag
const int32 FLAG_STEALTH = 0x02;
StatusFlags = UKismetMathLibrary::Xor_IntInt(StatusFlags, FLAG_STEALTH); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?