/* utils.c: Copyright (C) 2003-2008 Ludovic Rousseau 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include #include "ccid.h" #include "defs.h" #include "ccid_ifdhandler.h" #include "utils.h" #include "debug.h" int ReaderIndex[CCID_DRIVER_MAX_READERS]; #define FREE_ENTRY -42 void InitReaderIndex(void) { int i; for (i=0; i "BA" */ void p_bswap_16(void *ptr) { uint8_t *array, tmp; array = ptr; tmp = array[0]; array[0] = array[1]; array[1] = tmp; } /* swap a 32-bits integer in memory */ /* "ABCD" -> "DCBA" */ void p_bswap_32(void *ptr) { uint8_t *array, tmp; array = ptr; tmp = array[0]; array[0] = array[3]; array[3] = tmp; tmp = array[1]; array[1] = array[2]; array[2] = tmp; }