carb::extras::getFriendlyMemorySize

Defined in carb/extras/MemoryUsage.h

inline double carb::extras::getFriendlyMemorySize(size_t bytes, const char **suffix, MemoryScaleType scale = MemoryScaleType::eBinaryScale)

Retrieves a friendly memory size and scale suffix for a given number of bytes.

Parameters
  • bytes[in] The number of bytes to convert to a friendly memory size.

  • suffix[out] Receives the name of the suffix to the converted memory size amount. This is suitable for displaying to a user.

  • scale[in] Whether the conversion should be done using a decimal or binary scale. This defaults to MemoryScaleType::eBinaryScale.

Returns

The given memory size value bytes converted to the next lowest memory scale value (ie: megabytes, kilobytes, etc). The appropriate suffix string is returned through suffix.