RetroArch/libretro-common/include/clamping.h

63 lines
2.2 KiB
C
Raw Normal View History

2020-01-31 09:43:42 -05:00
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (clamping.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _LIBRETRO_SDK_CLAMPING_H
#define _LIBRETRO_SDK_CLAMPING_H
#include <stdint.h>
#include <retro_inline.h>
/**
Add Doxygen-styled comments to parts of the libretro API (#15641) * Touch up the documentation for a few environment calls * Touch up more comments * Update docs for more environment calls * Add doc comments for more environment calls * Change various @returns to indicate that the environment call is available - Some environment calls might be recognized but ignored (e.g. when fast-forwarding during netplay) * Note some deprecated symbols * Touch up the docs for RETRO_ENVIRONMENT_SET_MESSAGE * Touch up the docs for RETRO_ENVIRONMENT_SET_PIXEL_FORMAT * Add more doc comments * (libretro) Add more doxygen documentation for the libretro API * (libretro) Add doxygen comments for the callbacks * Document retro_init and retro_deinit * Add comments for retro_log-related symbols * Add a comment * Clean up some camera-related comments * Clean up frame time-related callbacks * Correct some information about major callbacks * Clarify some parameter info * Fix incorrect info about retro_set_environment * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * (libretro) Add doxygen docs on RETRO_THROTTLE * Touch up the docs for RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK * Touch up the docs for some macros * Touch up the docs for some more environment calls * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Tidy up the doc comments for clamping.h - It was a low-hanging fruit * Define some sections for constants - Doxygen will group all contained symbols on one page * Fix a duplicate @see * Polish up the docs for the rumble interface * Polish up the docs for RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Document INLINE * Clean up some tags * Touch up the docs for the sensor interface * Add docs for RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK * Update docs for RETRO_ENVIRONMENT_GET_INPUT_BITMASKS and accompanying names * Update some group definitions * Spiff up the docs for retro_dirent.h * Document dylib.h * Document base64.h * Document crc32.h * Touch up the docs for audio conversion functions * Clean up some Doxygen tags * Refine the docs for RETRO_ENVIRONMENT_GET_PERF_INTERFACE * Fix incorrect infor in dylib.h * Touch up the docs for RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE * Revise the docs for RETRO_ENVIRONMENT_SET_GEOMETRY * Revise the docs for RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE * Revise a function's doc * Touch up most of the rthreads docs * Touch up the retro_timers.h docs * Revise the subsystem docs * Fix some incorrect @see's * Touch up the docs for RETRO_ENVIRONMENT_GET_LED_INTERFACE * Give the RETRO_ENVIRONMENT_GET_SAVESTATE_CONTEXT docs a makeover * Slight cleanup to the microphone docs * Slight cleanup to the device power docs * Touch up serialization quirk docs * Give the MIDI docs a haircut * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Freshen up rtime's docs * Improve the docs and accompanying definitions for RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE - Revise the text of the documentation - Introduce an enum that defines the flags (it's still an int, so ABI compatibility will be fine) - Move the documentation for each bit to its corresponding enum * Shine the shoes of RETRO_ENVIRONMENT_GET_INPUT_MAX_USERS's docs * Freshen up the docs for fifo_queue.h * Document most of task_queue.h * Put retro_dirent's symbols in a group * Finish documenting task_queue.h * Document some compatibility headers * Document read_stdin * Document file_stream_transforms.h * Document the VFS API - Not the wrappers, just the plain API itself * (Docs) Add doxygen notes about RETRO_DEVICE_* * Fix some line breaks * Revise RETRO_DEVICE docs * Document strl.h * Update the features_cpu.h docs * Rewrite the docs for file_stream.h * Update the docs for retro_endianness.h * Update the docs for retro_miscellaneous.h * Document the RETRO_VFS_SEEK_POSITION constants * Finish documenting rthreads.h * Document network_stream.h * Put the RETRO_MEMORY defines in a defgroup * Move a doc comment in retro_common.h to file scope * Revise the docs for RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, and accompanying symbols * Fix the @param/in/out order in libretro.h's @param declarations * Tidy up the docs for RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION * Spiff up the docs for RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER * Fix some tags * Polish up RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE's docs * libretro: Add header doxygen * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Clean up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY * Clean up the docs for RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE * Touch up some comment syntax for RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE * Fix some inaccuracies * Re-add the license statement for libretro.h * Touch up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 * Touch up docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY * Touch up docs for some options-related symbols * Fix some syntax that was preventing most doc files from being generated * Express retro_core_option_definition docs in terms of retro_core_option_v2_definition * Finalize some core option-related docs * Fix some incorrect info about achievements * Polish up the docs for RETRO_ENVIRONMENT_SET_MEMORY_MAPS * Polish up the docs for RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION * Add a notice for `RETRO_ENVIRONMENT_GET_LOG_INTERFACE` * Update the disk control interface docs * Add a sentence to a doc comment * Update a comment * Remove an irrelevant @todo * Touch up the docs for `retro_message_target` * Touch up the docs for `retro_message_type` * Touch up the docs for `RETRO_ENVIRONMENT_SET_MESSAGE_EXT` * Touch up the docs for `RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK` * Touch up the docs for `RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY` * Revise a comment * Revise the docs for `RETRO_ENVIRONMENT_SET_VARIABLE` * Add a `@see` * Clean up the `RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE` docs * Update the Doxyfile * libretro: Add three more environment callback doxygen docs * doxygen: Remove @example reference --------- Co-authored-by: Rob Loach <robloach@gmail.com>
2024-03-09 20:24:01 -05:00
* Clamps a floating-point value to the specified range.
*
Add Doxygen-styled comments to parts of the libretro API (#15641) * Touch up the documentation for a few environment calls * Touch up more comments * Update docs for more environment calls * Add doc comments for more environment calls * Change various @returns to indicate that the environment call is available - Some environment calls might be recognized but ignored (e.g. when fast-forwarding during netplay) * Note some deprecated symbols * Touch up the docs for RETRO_ENVIRONMENT_SET_MESSAGE * Touch up the docs for RETRO_ENVIRONMENT_SET_PIXEL_FORMAT * Add more doc comments * (libretro) Add more doxygen documentation for the libretro API * (libretro) Add doxygen comments for the callbacks * Document retro_init and retro_deinit * Add comments for retro_log-related symbols * Add a comment * Clean up some camera-related comments * Clean up frame time-related callbacks * Correct some information about major callbacks * Clarify some parameter info * Fix incorrect info about retro_set_environment * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * (libretro) Add doxygen docs on RETRO_THROTTLE * Touch up the docs for RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK * Touch up the docs for some macros * Touch up the docs for some more environment calls * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Tidy up the doc comments for clamping.h - It was a low-hanging fruit * Define some sections for constants - Doxygen will group all contained symbols on one page * Fix a duplicate @see * Polish up the docs for the rumble interface * Polish up the docs for RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Document INLINE * Clean up some tags * Touch up the docs for the sensor interface * Add docs for RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK * Update docs for RETRO_ENVIRONMENT_GET_INPUT_BITMASKS and accompanying names * Update some group definitions * Spiff up the docs for retro_dirent.h * Document dylib.h * Document base64.h * Document crc32.h * Touch up the docs for audio conversion functions * Clean up some Doxygen tags * Refine the docs for RETRO_ENVIRONMENT_GET_PERF_INTERFACE * Fix incorrect infor in dylib.h * Touch up the docs for RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE * Revise the docs for RETRO_ENVIRONMENT_SET_GEOMETRY * Revise the docs for RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE * Revise a function's doc * Touch up most of the rthreads docs * Touch up the retro_timers.h docs * Revise the subsystem docs * Fix some incorrect @see's * Touch up the docs for RETRO_ENVIRONMENT_GET_LED_INTERFACE * Give the RETRO_ENVIRONMENT_GET_SAVESTATE_CONTEXT docs a makeover * Slight cleanup to the microphone docs * Slight cleanup to the device power docs * Touch up serialization quirk docs * Give the MIDI docs a haircut * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Freshen up rtime's docs * Improve the docs and accompanying definitions for RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE - Revise the text of the documentation - Introduce an enum that defines the flags (it's still an int, so ABI compatibility will be fine) - Move the documentation for each bit to its corresponding enum * Shine the shoes of RETRO_ENVIRONMENT_GET_INPUT_MAX_USERS's docs * Freshen up the docs for fifo_queue.h * Document most of task_queue.h * Put retro_dirent's symbols in a group * Finish documenting task_queue.h * Document some compatibility headers * Document read_stdin * Document file_stream_transforms.h * Document the VFS API - Not the wrappers, just the plain API itself * (Docs) Add doxygen notes about RETRO_DEVICE_* * Fix some line breaks * Revise RETRO_DEVICE docs * Document strl.h * Update the features_cpu.h docs * Rewrite the docs for file_stream.h * Update the docs for retro_endianness.h * Update the docs for retro_miscellaneous.h * Document the RETRO_VFS_SEEK_POSITION constants * Finish documenting rthreads.h * Document network_stream.h * Put the RETRO_MEMORY defines in a defgroup * Move a doc comment in retro_common.h to file scope * Revise the docs for RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, and accompanying symbols * Fix the @param/in/out order in libretro.h's @param declarations * Tidy up the docs for RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION * Spiff up the docs for RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER * Fix some tags * Polish up RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE's docs * libretro: Add header doxygen * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Clean up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY * Clean up the docs for RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE * Touch up some comment syntax for RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE * Fix some inaccuracies * Re-add the license statement for libretro.h * Touch up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 * Touch up docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY * Touch up docs for some options-related symbols * Fix some syntax that was preventing most doc files from being generated * Express retro_core_option_definition docs in terms of retro_core_option_v2_definition * Finalize some core option-related docs * Fix some incorrect info about achievements * Polish up the docs for RETRO_ENVIRONMENT_SET_MEMORY_MAPS * Polish up the docs for RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION * Add a notice for `RETRO_ENVIRONMENT_GET_LOG_INTERFACE` * Update the disk control interface docs * Add a sentence to a doc comment * Update a comment * Remove an irrelevant @todo * Touch up the docs for `retro_message_target` * Touch up the docs for `retro_message_type` * Touch up the docs for `RETRO_ENVIRONMENT_SET_MESSAGE_EXT` * Touch up the docs for `RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK` * Touch up the docs for `RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY` * Revise a comment * Revise the docs for `RETRO_ENVIRONMENT_SET_VARIABLE` * Add a `@see` * Clean up the `RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE` docs * Update the Doxyfile * libretro: Add three more environment callback doxygen docs * doxygen: Remove @example reference --------- Co-authored-by: Rob Loach <robloach@gmail.com>
2024-03-09 20:24:01 -05:00
* @param val The value to clamp.
* @param lower The minimum possible value.
* @param upper The maximum possible value.
*
Add Doxygen-styled comments to parts of the libretro API (#15641) * Touch up the documentation for a few environment calls * Touch up more comments * Update docs for more environment calls * Add doc comments for more environment calls * Change various @returns to indicate that the environment call is available - Some environment calls might be recognized but ignored (e.g. when fast-forwarding during netplay) * Note some deprecated symbols * Touch up the docs for RETRO_ENVIRONMENT_SET_MESSAGE * Touch up the docs for RETRO_ENVIRONMENT_SET_PIXEL_FORMAT * Add more doc comments * (libretro) Add more doxygen documentation for the libretro API * (libretro) Add doxygen comments for the callbacks * Document retro_init and retro_deinit * Add comments for retro_log-related symbols * Add a comment * Clean up some camera-related comments * Clean up frame time-related callbacks * Correct some information about major callbacks * Clarify some parameter info * Fix incorrect info about retro_set_environment * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * (libretro) Add doxygen docs on RETRO_THROTTLE * Touch up the docs for RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK * Touch up the docs for some macros * Touch up the docs for some more environment calls * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Tidy up the doc comments for clamping.h - It was a low-hanging fruit * Define some sections for constants - Doxygen will group all contained symbols on one page * Fix a duplicate @see * Polish up the docs for the rumble interface * Polish up the docs for RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Document INLINE * Clean up some tags * Touch up the docs for the sensor interface * Add docs for RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK * Update docs for RETRO_ENVIRONMENT_GET_INPUT_BITMASKS and accompanying names * Update some group definitions * Spiff up the docs for retro_dirent.h * Document dylib.h * Document base64.h * Document crc32.h * Touch up the docs for audio conversion functions * Clean up some Doxygen tags * Refine the docs for RETRO_ENVIRONMENT_GET_PERF_INTERFACE * Fix incorrect infor in dylib.h * Touch up the docs for RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE * Revise the docs for RETRO_ENVIRONMENT_SET_GEOMETRY * Revise the docs for RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE * Revise a function's doc * Touch up most of the rthreads docs * Touch up the retro_timers.h docs * Revise the subsystem docs * Fix some incorrect @see's * Touch up the docs for RETRO_ENVIRONMENT_GET_LED_INTERFACE * Give the RETRO_ENVIRONMENT_GET_SAVESTATE_CONTEXT docs a makeover * Slight cleanup to the microphone docs * Slight cleanup to the device power docs * Touch up serialization quirk docs * Give the MIDI docs a haircut * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Freshen up rtime's docs * Improve the docs and accompanying definitions for RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE - Revise the text of the documentation - Introduce an enum that defines the flags (it's still an int, so ABI compatibility will be fine) - Move the documentation for each bit to its corresponding enum * Shine the shoes of RETRO_ENVIRONMENT_GET_INPUT_MAX_USERS's docs * Freshen up the docs for fifo_queue.h * Document most of task_queue.h * Put retro_dirent's symbols in a group * Finish documenting task_queue.h * Document some compatibility headers * Document read_stdin * Document file_stream_transforms.h * Document the VFS API - Not the wrappers, just the plain API itself * (Docs) Add doxygen notes about RETRO_DEVICE_* * Fix some line breaks * Revise RETRO_DEVICE docs * Document strl.h * Update the features_cpu.h docs * Rewrite the docs for file_stream.h * Update the docs for retro_endianness.h * Update the docs for retro_miscellaneous.h * Document the RETRO_VFS_SEEK_POSITION constants * Finish documenting rthreads.h * Document network_stream.h * Put the RETRO_MEMORY defines in a defgroup * Move a doc comment in retro_common.h to file scope * Revise the docs for RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, and accompanying symbols * Fix the @param/in/out order in libretro.h's @param declarations * Tidy up the docs for RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION * Spiff up the docs for RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER * Fix some tags * Polish up RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE's docs * libretro: Add header doxygen * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Clean up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY * Clean up the docs for RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE * Touch up some comment syntax for RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE * Fix some inaccuracies * Re-add the license statement for libretro.h * Touch up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 * Touch up docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY * Touch up docs for some options-related symbols * Fix some syntax that was preventing most doc files from being generated * Express retro_core_option_definition docs in terms of retro_core_option_v2_definition * Finalize some core option-related docs * Fix some incorrect info about achievements * Polish up the docs for RETRO_ENVIRONMENT_SET_MEMORY_MAPS * Polish up the docs for RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION * Add a notice for `RETRO_ENVIRONMENT_GET_LOG_INTERFACE` * Update the disk control interface docs * Add a sentence to a doc comment * Update a comment * Remove an irrelevant @todo * Touch up the docs for `retro_message_target` * Touch up the docs for `retro_message_type` * Touch up the docs for `RETRO_ENVIRONMENT_SET_MESSAGE_EXT` * Touch up the docs for `RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK` * Touch up the docs for `RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY` * Revise a comment * Revise the docs for `RETRO_ENVIRONMENT_SET_VARIABLE` * Add a `@see` * Clean up the `RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE` docs * Update the Doxyfile * libretro: Add three more environment callback doxygen docs * doxygen: Remove @example reference --------- Co-authored-by: Rob Loach <robloach@gmail.com>
2024-03-09 20:24:01 -05:00
* @returns \c val clamped to between \c lower and \c upper (inclusive).
*/
static INLINE float clamp_float(float val, float lower, float upper)
{
if (val < lower)
return lower;
if (val > upper)
return upper;
return val;
}
/**
Add Doxygen-styled comments to parts of the libretro API (#15641) * Touch up the documentation for a few environment calls * Touch up more comments * Update docs for more environment calls * Add doc comments for more environment calls * Change various @returns to indicate that the environment call is available - Some environment calls might be recognized but ignored (e.g. when fast-forwarding during netplay) * Note some deprecated symbols * Touch up the docs for RETRO_ENVIRONMENT_SET_MESSAGE * Touch up the docs for RETRO_ENVIRONMENT_SET_PIXEL_FORMAT * Add more doc comments * (libretro) Add more doxygen documentation for the libretro API * (libretro) Add doxygen comments for the callbacks * Document retro_init and retro_deinit * Add comments for retro_log-related symbols * Add a comment * Clean up some camera-related comments * Clean up frame time-related callbacks * Correct some information about major callbacks * Clarify some parameter info * Fix incorrect info about retro_set_environment * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * (libretro) Add doxygen docs on RETRO_THROTTLE * Touch up the docs for RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK * Touch up the docs for some macros * Touch up the docs for some more environment calls * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Tidy up the doc comments for clamping.h - It was a low-hanging fruit * Define some sections for constants - Doxygen will group all contained symbols on one page * Fix a duplicate @see * Polish up the docs for the rumble interface * Polish up the docs for RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Document INLINE * Clean up some tags * Touch up the docs for the sensor interface * Add docs for RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK * Update docs for RETRO_ENVIRONMENT_GET_INPUT_BITMASKS and accompanying names * Update some group definitions * Spiff up the docs for retro_dirent.h * Document dylib.h * Document base64.h * Document crc32.h * Touch up the docs for audio conversion functions * Clean up some Doxygen tags * Refine the docs for RETRO_ENVIRONMENT_GET_PERF_INTERFACE * Fix incorrect infor in dylib.h * Touch up the docs for RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE * Revise the docs for RETRO_ENVIRONMENT_SET_GEOMETRY * Revise the docs for RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE * Revise a function's doc * Touch up most of the rthreads docs * Touch up the retro_timers.h docs * Revise the subsystem docs * Fix some incorrect @see's * Touch up the docs for RETRO_ENVIRONMENT_GET_LED_INTERFACE * Give the RETRO_ENVIRONMENT_GET_SAVESTATE_CONTEXT docs a makeover * Slight cleanup to the microphone docs * Slight cleanup to the device power docs * Touch up serialization quirk docs * Give the MIDI docs a haircut * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Freshen up rtime's docs * Improve the docs and accompanying definitions for RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE - Revise the text of the documentation - Introduce an enum that defines the flags (it's still an int, so ABI compatibility will be fine) - Move the documentation for each bit to its corresponding enum * Shine the shoes of RETRO_ENVIRONMENT_GET_INPUT_MAX_USERS's docs * Freshen up the docs for fifo_queue.h * Document most of task_queue.h * Put retro_dirent's symbols in a group * Finish documenting task_queue.h * Document some compatibility headers * Document read_stdin * Document file_stream_transforms.h * Document the VFS API - Not the wrappers, just the plain API itself * (Docs) Add doxygen notes about RETRO_DEVICE_* * Fix some line breaks * Revise RETRO_DEVICE docs * Document strl.h * Update the features_cpu.h docs * Rewrite the docs for file_stream.h * Update the docs for retro_endianness.h * Update the docs for retro_miscellaneous.h * Document the RETRO_VFS_SEEK_POSITION constants * Finish documenting rthreads.h * Document network_stream.h * Put the RETRO_MEMORY defines in a defgroup * Move a doc comment in retro_common.h to file scope * Revise the docs for RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, and accompanying symbols * Fix the @param/in/out order in libretro.h's @param declarations * Tidy up the docs for RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION * Spiff up the docs for RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER * Fix some tags * Polish up RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE's docs * libretro: Add header doxygen * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Clean up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY * Clean up the docs for RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE * Touch up some comment syntax for RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE * Fix some inaccuracies * Re-add the license statement for libretro.h * Touch up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 * Touch up docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY * Touch up docs for some options-related symbols * Fix some syntax that was preventing most doc files from being generated * Express retro_core_option_definition docs in terms of retro_core_option_v2_definition * Finalize some core option-related docs * Fix some incorrect info about achievements * Polish up the docs for RETRO_ENVIRONMENT_SET_MEMORY_MAPS * Polish up the docs for RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION * Add a notice for `RETRO_ENVIRONMENT_GET_LOG_INTERFACE` * Update the disk control interface docs * Add a sentence to a doc comment * Update a comment * Remove an irrelevant @todo * Touch up the docs for `retro_message_target` * Touch up the docs for `retro_message_type` * Touch up the docs for `RETRO_ENVIRONMENT_SET_MESSAGE_EXT` * Touch up the docs for `RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK` * Touch up the docs for `RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY` * Revise a comment * Revise the docs for `RETRO_ENVIRONMENT_SET_VARIABLE` * Add a `@see` * Clean up the `RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE` docs * Update the Doxyfile * libretro: Add three more environment callback doxygen docs * doxygen: Remove @example reference --------- Co-authored-by: Rob Loach <robloach@gmail.com>
2024-03-09 20:24:01 -05:00
* Clamps an integer to fit in 8 bits.
*
Add Doxygen-styled comments to parts of the libretro API (#15641) * Touch up the documentation for a few environment calls * Touch up more comments * Update docs for more environment calls * Add doc comments for more environment calls * Change various @returns to indicate that the environment call is available - Some environment calls might be recognized but ignored (e.g. when fast-forwarding during netplay) * Note some deprecated symbols * Touch up the docs for RETRO_ENVIRONMENT_SET_MESSAGE * Touch up the docs for RETRO_ENVIRONMENT_SET_PIXEL_FORMAT * Add more doc comments * (libretro) Add more doxygen documentation for the libretro API * (libretro) Add doxygen comments for the callbacks * Document retro_init and retro_deinit * Add comments for retro_log-related symbols * Add a comment * Clean up some camera-related comments * Clean up frame time-related callbacks * Correct some information about major callbacks * Clarify some parameter info * Fix incorrect info about retro_set_environment * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * (libretro) Add doxygen docs on RETRO_THROTTLE * Touch up the docs for RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK * Touch up the docs for some macros * Touch up the docs for some more environment calls * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Tidy up the doc comments for clamping.h - It was a low-hanging fruit * Define some sections for constants - Doxygen will group all contained symbols on one page * Fix a duplicate @see * Polish up the docs for the rumble interface * Polish up the docs for RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Document INLINE * Clean up some tags * Touch up the docs for the sensor interface * Add docs for RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK * Update docs for RETRO_ENVIRONMENT_GET_INPUT_BITMASKS and accompanying names * Update some group definitions * Spiff up the docs for retro_dirent.h * Document dylib.h * Document base64.h * Document crc32.h * Touch up the docs for audio conversion functions * Clean up some Doxygen tags * Refine the docs for RETRO_ENVIRONMENT_GET_PERF_INTERFACE * Fix incorrect infor in dylib.h * Touch up the docs for RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE * Revise the docs for RETRO_ENVIRONMENT_SET_GEOMETRY * Revise the docs for RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE * Revise a function's doc * Touch up most of the rthreads docs * Touch up the retro_timers.h docs * Revise the subsystem docs * Fix some incorrect @see's * Touch up the docs for RETRO_ENVIRONMENT_GET_LED_INTERFACE * Give the RETRO_ENVIRONMENT_GET_SAVESTATE_CONTEXT docs a makeover * Slight cleanup to the microphone docs * Slight cleanup to the device power docs * Touch up serialization quirk docs * Give the MIDI docs a haircut * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Freshen up rtime's docs * Improve the docs and accompanying definitions for RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE - Revise the text of the documentation - Introduce an enum that defines the flags (it's still an int, so ABI compatibility will be fine) - Move the documentation for each bit to its corresponding enum * Shine the shoes of RETRO_ENVIRONMENT_GET_INPUT_MAX_USERS's docs * Freshen up the docs for fifo_queue.h * Document most of task_queue.h * Put retro_dirent's symbols in a group * Finish documenting task_queue.h * Document some compatibility headers * Document read_stdin * Document file_stream_transforms.h * Document the VFS API - Not the wrappers, just the plain API itself * (Docs) Add doxygen notes about RETRO_DEVICE_* * Fix some line breaks * Revise RETRO_DEVICE docs * Document strl.h * Update the features_cpu.h docs * Rewrite the docs for file_stream.h * Update the docs for retro_endianness.h * Update the docs for retro_miscellaneous.h * Document the RETRO_VFS_SEEK_POSITION constants * Finish documenting rthreads.h * Document network_stream.h * Put the RETRO_MEMORY defines in a defgroup * Move a doc comment in retro_common.h to file scope * Revise the docs for RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, and accompanying symbols * Fix the @param/in/out order in libretro.h's @param declarations * Tidy up the docs for RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION * Spiff up the docs for RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER * Fix some tags * Polish up RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE's docs * libretro: Add header doxygen * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Update libretro-common/include/libretro.h Co-authored-by: Rob Loach <robloach@gmail.com> * Clean up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY * Clean up the docs for RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIATION_INTERFACE * Touch up some comment syntax for RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE * Fix some inaccuracies * Re-add the license statement for libretro.h * Touch up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2 * Touch up docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY * Touch up docs for some options-related symbols * Fix some syntax that was preventing most doc files from being generated * Express retro_core_option_definition docs in terms of retro_core_option_v2_definition * Finalize some core option-related docs * Fix some incorrect info about achievements * Polish up the docs for RETRO_ENVIRONMENT_SET_MEMORY_MAPS * Polish up the docs for RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_VERSION * Add a notice for `RETRO_ENVIRONMENT_GET_LOG_INTERFACE` * Update the disk control interface docs * Add a sentence to a doc comment * Update a comment * Remove an irrelevant @todo * Touch up the docs for `retro_message_target` * Touch up the docs for `retro_message_type` * Touch up the docs for `RETRO_ENVIRONMENT_SET_MESSAGE_EXT` * Touch up the docs for `RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK` * Touch up the docs for `RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY` * Revise a comment * Revise the docs for `RETRO_ENVIRONMENT_SET_VARIABLE` * Add a `@see` * Clean up the `RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE` docs * Update the Doxyfile * libretro: Add three more environment callback doxygen docs * doxygen: Remove @example reference --------- Co-authored-by: Rob Loach <robloach@gmail.com>
2024-03-09 20:24:01 -05:00
* @param val The value to clamp.
* @return \c val clamped to between 0 and 255 (inclusive).
*/
static INLINE uint8_t clamp_8bit(int val)
{
if (val > 255)
return 255;
if (val < 0)
return 0;
return (uint8_t)val;
}
#endif