ToyGine2 26.2.0
Game Engine for retro consoles
Loading...
Searching...
No Matches
utils.cpp File Reference

Definitions for string, encoding, and number utilities declared in core/utils.hpp. More...

#include "core.hpp"
Include dependency graph for utils.cpp:

Classes

struct  toy::_divmod10

Namespaces

namespace  toy
 Root namespace containing all engine modules.

Functions

constexpr _divmod10 toy::_divModU10 (uint32_t value) noexcept
 Divides a given 32-bit unsigned integer by 10 and returns the quotient and remainder.
constexpr int32_t toy::_ftoa32Engine (char *buffer, float value, size_t precision) noexcept
 Converts a floating-point number to its string representation in a specified precision.
constexpr int32_t toy::_ftoa64Engine (char *buffer, double value, size_t precision) noexcept
 Converts a 64-bit floating-point number to its string representation with specified precision.
void toy::_floatPostProcess (char *dest, char *srcBuffer, size_t bufferSize, int32_t exp10, size_t precision) noexcept
 Processes a string representation of a floating-point number, adjusting the exponent, and stripping trailing zeros.
wchar_t * toy::utf8toWChar (wchar_t *dest, size_t destSize, const char *src, size_t count) noexcept
 Converts a UTF-8 C string to a wide-character string with a character count limit.
char * toy::wcharToUtf8 (char *dest, size_t destSize, const wchar_t *src) noexcept
 Converts a wide-character C string to UTF-8.
size_t toy::utf8Len (const char *string) noexcept
 Returns the number of Unicode code points in a UTF-8 encoded C string.
char * toy::ftoa (char *dest, size_t destSize, float value, size_t precision=7) noexcept
 Converts a float to its decimal C string representation with specified precision.
char * toy::ftoa (char *dest, size_t destSize, double value, size_t precision=15) noexcept
 Converts a double to its decimal C string representation with specified precision.
void toy::formatNumberString (char *buffer, size_t bufferSize, const char *separator) noexcept
 Inserts a grouping separator into a number C string every three digits from the right.

Variables

static constexpr array< uint8_t, 256 > toy::_utf8CharSizeTable
 UTF-8 character size lookup table for efficient UTF-8 parsing.
constexpr array< uint32_t, 32 > toy::_exponentTable
 Precomputed exponent lookup table for efficient binary-to-decimal floating-point conversion.
constexpr size_t toy::_decimalDigitsPerGroup = 3
 Number of decimal digits per group when formatNumberString() inserts the caller-supplied separator.

Detailed Description

Definitions for string, encoding, and number utilities declared in core/utils.hpp.