From a07c526460d1a3aa0a4e863a33059f1ade32c310 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Sun, 2 Aug 2015 21:56:08 +0200 Subject: [PATCH] eina: add intermediate inline function for eina_crc. This is necessary to make my life easier when adding assembling implementation of eina_crc. --- src/Makefile_Eina.am | 1 + src/lib/eina/eina_crc.c | 2 +- src/lib/eina/eina_crc.h | 4 +++- src/lib/eina/eina_inline_crc.x | 30 ++++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 src/lib/eina/eina_inline_crc.x diff --git a/src/Makefile_Eina.am b/src/Makefile_Eina.am index 316542ceaa..aab92e22d4 100644 --- a/src/Makefile_Eina.am +++ b/src/Makefile_Eina.am @@ -89,6 +89,7 @@ lib/eina/eina_thread_queue.h \ lib/eina/eina_matrix.h \ lib/eina/eina_quad.h \ lib/eina/eina_crc.h \ +lib/eina/eina_inline_crc.x \ lib/eina/eina_evlog.h \ lib/eina/eina_util.h \ lib/eina/eina_quaternion.h diff --git a/src/lib/eina/eina_crc.c b/src/lib/eina/eina_crc.c index 29ec08c894..e509dc8057 100644 --- a/src/lib/eina/eina_crc.c +++ b/src/lib/eina/eina_crc.c @@ -288,7 +288,7 @@ static const unsigned int table[8][256] = }; EAPI unsigned int -eina_crc(const char *data, int len, unsigned int seed, Eina_Bool start_stream) +_eina_crc(const char *data, int len, unsigned int seed, Eina_Bool start_stream) { unsigned int crc; unsigned int* curr = (unsigned int*) data; diff --git a/src/lib/eina/eina_crc.h b/src/lib/eina/eina_crc.h index 099a921de1..819ca911dd 100644 --- a/src/lib/eina/eina_crc.h +++ b/src/lib/eina/eina_crc.h @@ -40,6 +40,8 @@ * * @since 1.15 */ -EAPI unsigned int eina_crc(const char *key, int len, unsigned int seed, Eina_Bool start_stream) EINA_ARG_NONNULL(2, 3); +static inline unsigned int eina_crc(const char *key, int len, unsigned int seed, Eina_Bool start_stream) EINA_ARG_NONNULL(2, 3); + +#include "eina_inline_crc.x" #endif diff --git a/src/lib/eina/eina_inline_crc.x b/src/lib/eina/eina_inline_crc.x new file mode 100644 index 0000000000..41589f17fc --- /dev/null +++ b/src/lib/eina/eina_inline_crc.x @@ -0,0 +1,30 @@ +/* EINA - EFL data type library + * Copyright (C) 20015 Cedric BAIL + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; + * if not, see . + */ + +#ifndef EINA_INLINE_CRC_X_ +#define EINA_INLINE_CRC_X_ + +EAPI unsigned int _eina_crc(const char *data, int len, unsigned int seed, Eina_Bool start_stream); + +static inline unsigned int +eina_crc(const char *key, int len, unsigned int seed, Eina_Bool start_stream) +{ + return _eina_crc(key, len, seed, start_stream); +} + +#endif