host: Reorganized some common host code
Moved some min/max static inline's and string to numeric type conversions to a common host code area.
This commit is contained in:
parent
d53423c671
commit
0c06cb8886
2 changed files with 32 additions and 0 deletions
1
firmware_common/README.md
Normal file
1
firmware_common/README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
This directory contains files shared between firmware and host software.
|
||||
31
host/common/minmax.h
Normal file
31
host/common/minmax.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* @brief These static inline routines are preferred over the use of macros,
|
||||
* as they provide type safety.
|
||||
*/
|
||||
|
||||
#ifndef MINMAX_H__
|
||||
#define MINMAX_H__
|
||||
|
||||
|
||||
static inline size_t min_sz(size_t x, size_t y)
|
||||
{
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
static inline size_t max_sz(size_t x, size_t y)
|
||||
{
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
static inline unsigned int uint_min(unsigned int x, unsigned int y)
|
||||
{
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
static inline unsigned int uint_max(unsigned int x, unsigned int y)
|
||||
{
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue