1%% options 2 3copyright owner = Dirk Krause 4copyright year = 2015-xxxx 5SPDX-License-Identifier: BSD-3-Clause 6 7 8 9%% header 10 11/** @file 12 Comparison between signed and unsigned 13 short. 14*/ 15 16#ifdef __cplusplus 17extern "C" { 18#endif 19 20/** Compare signed and unsigned short. 21 @param s Signed short. 22 @param u Unsigned short. 23 @return 1 if s>u, 0 if s==u, -1 if s<u. 24*/ 25int 26dk4ma_short_compare(short s, unsigned short u); 27 28#ifdef __cplusplus 29} 30#endif 31 32 33 34%% module 35 36#include "dk4conf.h" 37#include <libdk4ma/dk4macs.h> 38 39int 40dk4ma_short_compare(short s, unsigned short u) 41{ 42 int back = 0; 43 if (0 > s) { 44 back = -1; 45 } else { 46 if ((unsigned short)s < u) { 47 back = -1; 48 } else { 49 if ((unsigned short)s > u) { 50 back = 1; 51 } 52 } 53 } 54 return back; 55} 56 57