GflsUtils

GflsUtils — Utility functions

Functions

Includes

#include <gfls/gfls.h>

Description

Utility functions.

Functions

gfls_utils_bytes_to_hex_representation ()

gchar *
gfls_utils_bytes_to_hex_representation
                               (const guint8 *bytes,
                                gsize n_bytes);

Returns an ASCII string with each byte taking three characters: backslash followed by the two hex digits.

A use-case is for inserting invalid characters into a GTK widget or anything else that accepts only valid UTF-8 strings.

Parameters

bytes

the bytes.

 

n_bytes

the number of bytes.

 

Returns

an hexadecimal string representation of bytes . The string is nul-terminated.

[transfer full]

Since: 0.5


gfls_utils_find_nearest_power_of_two ()

gsize
gfls_utils_find_nearest_power_of_two (gsize number);

One use-case is for memory (re-)allocations.

Parameters

number

a number.

 

Returns

the smallest power of 2 greater than or equal to number , or 0 if such power does not fit in a gsize.

Since: 0.5