1 /****************************************************************************
3 Author : Gabriele 'matrix' Gristina <gabriele.gristina@gmail.com>
4 Date : Sun Jan 10 13:59:37 CET 2021
6 License: GNU General Public License v3 or any later version (see LICENSE.txt)
8 *****************************************************************************
9 Copyright (C) 2020-2021 <Gabriele Gristina>
11 This program is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 ****************************************************************************/
26 // trust me...i'm a dolphin :P
27 // too many allocations, too many free to manage, I need dolphin macros :)
28 // they could be buggy, but if you know how to fix them, do it
30 #define MEMORY_FREE_ADD(a) { \
31 freeList[freeListIdx++] = (void *)(a); \
34 #define MEMORY_FREE_ALL { \
35 int t = freeListIdx; \
37 if (freeList[t] != NULL) { \
42 if (freeList != NULL) { \
48 #define MEMORY_FREE_DEL(a) { \
49 for (int i = 0; i < freeListIdx; i++) { \
50 if (freeList[i] && a == freeList[i]) { \
58 #define MEMORY_FREE_LIST(a,i) { \
71 #define MEMORY_FREE_LIST_Z(a,i) { \
82 #define MEMORY_FREE_OPENCL(c,i) { \
86 clReleaseContext (c.contexts[t]); \
87 if (c.keystreams[t]) \
88 clReleaseMemObject (c.keystreams[t]); \
89 if (c.candidates[t]) \
90 clReleaseMemObject (c.candidates[t]); \
92 clReleaseMemObject (c.matches[t]); \
93 if (c.matches_found[t]) \
94 clReleaseMemObject (c.matches_found[t]); \
96 clReleaseCommandQueue (c.commands[t]); \
98 clReleaseKernel (c.kernels[t]); \
100 clReleaseProgram (c.programs[t]); \
101 } while (--t >= 0); \