TChar::ToUnsigned

Avoid sign extension problems with signed characters smaller than int

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Misc/Char.h

Include

#include "Misc/Char.h"

Syntax

static constexpr uint32 ToUnsigned
(
    CharType Char
)

Remarks

Avoid sign extension problems with signed characters smaller than int

E.g. 'Ö' - 'A' is negative since the char 'Ö' (0xD6) is negative and gets sign-extended to the 32-bit int 0xFFFFFFD6 before subtraction happens.

Mainly needed for subtraction and addition.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss