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	long long.
14*/
15
16#ifndef DK4CONF_H_INCLUDED
17#if DK4_BUILDING_DKTOOLS4
18#include "dk4conf.h"
19#else
20#include <dktools-4/dk4conf.h>
21#endif
22#endif
23
24#ifndef DK4TYPES_H_INCLUDED
25#if DK4_BUILDING_DKTOOLS4
26#include <libdk4base/dk4types.h>
27#else
28#include <dktools-4/dk4types.h>
29#endif
30#endif
31
32
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38#if DK4_HAVE_LONG_LONG
39
40/**	Compare signed and unsigned long long.
41	@param	s	Signed long long.
42	@param	u	Unsigned long long.
43	@return	1 if s>u, 0 if s==u, -1 if s<u.
44*/
45int
46dk4ma_long_long_compare(long long s, unsigned long long u);
47
48#endif
49
50#ifdef __cplusplus
51}
52#endif
53
54
55
56%%	module
57
58#include "dk4conf.h"
59#include <libdk4ma/dk4macll.h>
60
61#if DK4_HAVE_LONG_LONG
62
63int
64dk4ma_long_long_compare(long long s, unsigned long long u)
65{
66  int	back	=	0;
67  if (0LL > s) {
68    back = -1;
69  } else {
70    if ((unsigned long long)s < u) {
71      back = -1;
72    } else {
73      if ((unsigned long long)s > u) {
74        back = 1;
75      }
76    }
77  }
78  return back;
79}
80
81#endif
82
83