UKismetMathLibrary::Conv_Int64ToByte
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureBlueprintAutocast
Description
Converts a 64-bit integer to a byte (uint8) by keeping only the low 8 bits. Values larger than 255 wrap around silently.
Caveats & Gotchas
- • Truncation is silent — if InInt is 256 the result is 0, if it is 257 the result is 1. There is no out-of-range warning in Blueprint or C++. Always clamp the value first if overflow would be a bug: UKismetMathLibrary::Clamp64(InInt, 0, 255).
- • Negative int64 values produce non-zero bytes due to two's-complement representation (e.g. -1 → 255). If the source can be negative, clamp or abs before converting.
Signature
static UE_INL_API uint8 Conv_Int64ToByte(int64 InInt) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InInt | int64 | The 64-bit integer to truncate to a byte. | — |
Return Type
uint8 Example
Safe clamped conversion C++
int64 BigIndex = GetSomeIndex64();
// Clamp before converting to avoid silent truncation
int64 Clamped = FMath::Clamp<int64>(BigIndex, 0, 255);
uint8 ByteValue = UKismetMathLibrary::Conv_Int64ToByte(Clamped); Tags
Version History
Introduced in: 5.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?