mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-22 13:31:08 +00:00
Added lengthof.
This commit is contained in:
parent
f05cd77eb4
commit
3271fc9d28
@ -74,4 +74,15 @@ extern uint32 InterruptFlags; // Currently pending interrupts
|
||||
extern void SetInterruptFlag(uint32 flag); // Set/clear interrupt flags
|
||||
extern void ClearInterruptFlag(uint32 flag);
|
||||
|
||||
// Array length
|
||||
#if __cplusplus >= 201103L || (_MSC_VER >= 1900 && defined __cplusplus)
|
||||
template <typename T, size_t size>
|
||||
constexpr size_t lengthof(T (& a)[size])
|
||||
{
|
||||
return size;
|
||||
}
|
||||
#else
|
||||
#define lengthof(a) (sizeof(a) / sizeof(a[0]))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user