aboutsummaryrefslogtreecommitdiff
path: root/llimits.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-05-27 09:43:37 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-05-27 09:43:37 -0300
commitd630daca1a3dad6357226fdc6472692fa7e4b5c0 (patch)
treec4fa77406b680091b4325e46736fe85ac012279c /llimits.h
parent8c883cb4e86a6c176465c9347dfff5e0044f1c93 (diff)
downloadlua-d630daca1a3dad6357226fdc6472692fa7e4b5c0.tar.gz
lua-d630daca1a3dad6357226fdc6472692fa7e4b5c0.tar.bz2
lua-d630daca1a3dad6357226fdc6472692fa7e4b5c0.zip
"legal" way to convert a float to an integer in C
Diffstat (limited to 'llimits.h')
-rw-r--r--llimits.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/llimits.h b/llimits.h
index e15c1fd5..04405019 100644
--- a/llimits.h
+++ b/llimits.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llimits.h,v 1.104 2013/04/25 21:15:37 roberto Exp roberto $ 2** $Id: llimits.h,v 1.105 2013/05/23 21:27:06 roberto Exp roberto $
3** Limits, basic types, and some other `installation-dependent' definitions 3** Limits, basic types, and some other `installation-dependent' definitions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -36,6 +36,12 @@ typedef unsigned char lu_byte;
36 36
37#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ 37#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
38 38
39
40/* minimum and maximum values for lua_Integer */
41#define MAX_INTEGER ((lua_Integer)(~(lua_Unsigned)0 >> 1))
42#define MIN_INTEGER (~MAX_INTEGER)
43
44
39/* 45/*
40** conversion of pointer to integer 46** conversion of pointer to integer
41** this is for hashing only; there is no problem if the integer 47** this is for hashing only; there is no problem if the integer