diff options
Diffstat (limited to 'src/buf.c')
| -rw-r--r-- | src/buf.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/buf.c b/src/buf.c new file mode 100644 index 0000000..70b66ad --- /dev/null +++ b/src/buf.c | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | // buf.c --- buffer -*- C -*- | ||
| 2 | // | ||
| 3 | // Copyright (c) 2026 Martin Michalec <martin@michalec.dev> | ||
| 4 | // | ||
| 5 | // SPDX-License-Identifier: MIT | ||
| 6 | // | ||
| 7 | // This file is part of COSMOS Codebase. | ||
| 8 | // | ||
| 9 | // Commentary: | ||
| 10 | // | ||
| 11 | // Code: | ||
| 12 | |||
| 13 | #include "buf.h" | ||
| 14 | #include "dbg.h" | ||
| 15 | |||
| 16 | struct buf | ||
| 17 | buf_from (void *beg, void *ptr, void *end) | ||
| 18 | { | ||
| 19 | return (struct buf) { .beg = beg, .ptr = ptr, .end = end }; | ||
| 20 | } | ||
| 21 | |||
| 22 | struct buf | ||
| 23 | buf_from_mb (struct mb mb) | ||
| 24 | { | ||
| 25 | return buf_from (mb.ptr, mb.ptr, MB_END (mb)); | ||
| 26 | } | ||
| 27 | |||
| 28 | // buf.c ends here | ||
