UKismetMathLibrary::And_IntInt
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Bitwise AND of two integers (A & B). Useful for testing or clearing specific flag bits.
Caveats & Gotchas
- • Blueprint treats integers as signed int32; the sign bit (bit 31) participates in the AND like any other bit, which can produce negative results when masking values near INT_MAX.
- • This is a pure bitwise operation — do not confuse it with logical AND (&&). Passing booleans cast to int will work, but using it as a substitute for logical AND can introduce subtle bugs with non-zero non-one values.
Signature
static UE_INL_API int32 And_IntInt(int32 A, int32 B); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | int32 | First operand. | — |
| B | int32 | Second operand (the mask). | — |
Return Type
int32 Example
Test a flag bit C++
// Check if flag bit 2 is set
const int32 FLAG_INVINCIBLE = 0x04;
if (UKismetMathLibrary::And_IntInt(StatusFlags, FLAG_INVINCIBLE) != 0)
{
SkipDamage();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?