You can `#define NWR_ASSERT(x)` before the #include to avoid using assert.h.

To override the default alignment, `#define NWR_MEM_DEFAULT_ALIGNMENT n`, where
n is the alignment you want. This should be a power of 2. Default alignment is
used whenever you pass 0 into an alignment field.

If you only want one specific allocator you can `#define NWR_ONLY_X` before the
include, where X is the allocator you want. E.g.

This library contains an integer constant `NWR_MEM_VERSION` which will be bumped
any time the API undergoes a change that breaks backwards compatibility.

### API Quick Reference
The actual api is all snake case, and you prefix everything with `nwr`. Functions
are prefixed by the allocator they take. For example, if I want to
call `is subregion alive?` on a `Region`, I say:

### Region documentation
`Region` supports growing up or down in memory. If you want the region to grow
down (e.g. when using with memory on the stack) you can pass `NWR_REGION_GROWS_DOWN`
into `flags` when you call `create`. Note that `flags` is not const, this is done so
that you can use the unused bits in the flags field for your own hacks. If more
flags are added in the future, `NWR_MEM_VERSION` will be increased, indicating a
break in backwards compatibility.

`Expand` should not be called on a region that grows down, as this does not make
sense and is not supported.

//if you are using memory on the stack, you might want the region to grow down instead of up:
void * stack_mem = alloca(raw_len);
nwr_region sregion = nwr_region_create(stack_mem, raw_len, 0, NWR_REGION_GROWS_DOWN);

1
2
3
4
5

//now, let's try a different alignment:
nwr_region aregion = nwr_region_create(ptr, len, 64, 0);
//note that alignment must be a power of 2. The region may use less memory
//than what is available in the backing store because the region will be aligned within it.
//you can use nwr_region_available to see how much space the region can use

ALTERNATIVE A - MIT License
Copyright (c) 2017 Mio Iwakura
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.
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
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 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.