~ubuntu-branches/ubuntu/wily/aegisub/wily

« back to all changes in this revision

Viewing changes to vendor/luabins/src/luainternals.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Reichel, Pascal De Vuyst, Juan Picca, Sebastian Reichel
  • Date: 2015-08-04 21:40:50 UTC
  • mfrom: (5.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20150804214050-y2aghm9vdksoc8t7
Tags: 3.2.2+dfsg-1
[ Pascal De Vuyst ]
* Fix Typo in package description (Closes: #739219)

[ Juan Picca ]
* Add patch to fix reproducible build (Closes: #789728)

[ Sebastian Reichel ]
* New upstream release
 - remove vendor directory from orig tarball
* Update Debian Standards Version to 3.9.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* luainternals.c
 
3
* Code quoted from MIT-licensed Lua 5.1.4 internals
 
4
* See copyright notice in lua.h
 
5
*/
 
6
 
 
7
#ifdef __cplusplus
 
8
extern "C" {
 
9
#endif /* __cplusplus */
 
10
 
 
11
#include <lua.h>
 
12
#include <lauxlib.h>
 
13
 
 
14
#ifdef __cplusplus
 
15
}
 
16
#endif /* __cplusplus */
 
17
 
 
18
#include "luainternals.h"
 
19
 
 
20
/*
 
21
* BEGIN COPY-PASTE FROM Lua 5.1.4 llimits.h
 
22
*/
 
23
 
 
24
/* chars used as small naturals (so that `char' is reserved for characters) */
 
25
typedef unsigned char lu_byte;
 
26
 
 
27
/*
 
28
* END COPY-PASTE FROM Lua 5.1.4 llimits.h
 
29
*/
 
30
 
 
31
/*
 
32
* BEGIN COPY-PASTE FROM Lua 5.1.4 lobject.c
 
33
*/
 
34
 
 
35
int luaO_log2 (unsigned int x) {
 
36
  static const lu_byte log_2[256] = {
 
37
    0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
 
38
    6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
 
39
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
 
40
    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
 
41
    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
 
42
    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
 
43
    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
 
44
    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
 
45
  };
 
46
  int l = -1;
 
47
  while (x >= 256) { l += 8; x >>= 8; }
 
48
  return l + log_2[x];
 
49
 
 
50
}
 
51
 
 
52
/*
 
53
* END COPY-PASTE FROM Lua 5.1.4 lobject.c
 
54
*/