Update and rename objpool README.txt to objpool_README.md
This commit is contained in:
parent
6d320de48a
commit
3235369e74
|
|
@ -23,7 +23,7 @@ Explanation & Usage:
|
||||||
We have two constructor functions:
|
We have two constructor functions:
|
||||||
```c
|
```c
|
||||||
struct ObjPool ObjPool_Create(size_t objsize, size_t len);
|
struct ObjPool ObjPool_Create(size_t objsize, size_t len);
|
||||||
struct ObjPool ObjPool_FromBuffer(size_t objsize, size_t len, void *buf);
|
struct ObjPool ObjPool_FromBuffer(void *buf, size_t objsize, size_t len);
|
||||||
```
|
```
|
||||||
|
|
||||||
To which you create a `struct ObjPool` instance and give the size of your object and how many objects for the pool to hold.
|
To which you create a `struct ObjPool` instance and give the size of your object and how many objects for the pool to hold.
|
||||||
|
|
@ -43,7 +43,7 @@ Explanation & Usage:
|
||||||
Alternatively, if for any reason that you cannot use dynamic memory allocation, you have the option of using an existing buffer for the object pool:
|
Alternatively, if for any reason that you cannot use dynamic memory allocation, you have the option of using an existing buffer for the object pool:
|
||||||
```c
|
```c
|
||||||
struct vec3D vectors[100];
|
struct vec3D vectors[100];
|
||||||
struct ObjPool vector_pool = ObjPool_FromBuffer(sizeof(struct vec3D), 1[&vector] - 0[&vector], vectors);
|
struct ObjPool vector_pool = ObjPool_FromBuffer(vectors, sizeof(struct vec3D), 1[&vector] - 0[&vector]);
|
||||||
```
|
```
|
||||||
The buffer MUST be aligned to the size of `size_t` AND the object size must not be smaller than a `size_t` either.
|
The buffer MUST be aligned to the size of `size_t` AND the object size must not be smaller than a `size_t` either.
|
||||||
|
|
||||||
|
|
@ -72,5 +72,3 @@ Explanation & Usage:
|
||||||
```c
|
```c
|
||||||
ObjPool_Free(&vector_pool, origin), origin = NULL;
|
ObjPool_Free(&vector_pool, origin), origin = NULL;
|
||||||
```
|
```
|
||||||
|
|
||||||
You may also optionally back your
|
|
||||||
Loading…
Reference in New Issue
Block a user