Add a Stack convenience class
This commit is contained in:
parent
0bbd026660
commit
8da5521273
23
luna/include/luna/Stack.h
Normal file
23
luna/include/luna/Stack.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include <luna/Types.h>
|
||||
|
||||
struct Stack
|
||||
{
|
||||
Stack(u64 base, usize bytes);
|
||||
|
||||
u64 bottom()
|
||||
{
|
||||
return m_base;
|
||||
}
|
||||
|
||||
u64 top();
|
||||
|
||||
usize bytes()
|
||||
{
|
||||
return m_bytes;
|
||||
}
|
||||
|
||||
private:
|
||||
u64 m_base;
|
||||
usize m_bytes;
|
||||
};
|
10
luna/src/Stack.cpp
Normal file
10
luna/src/Stack.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include <luna/Stack.h>
|
||||
|
||||
Stack::Stack(u64 base, usize bytes) : m_base(base), m_bytes(bytes)
|
||||
{
|
||||
}
|
||||
|
||||
u64 Stack::top()
|
||||
{
|
||||
return (m_base + m_bytes) - sizeof(void*);
|
||||
}
|
Loading…
Reference in New Issue
Block a user