ReactOS  0.4.14-dev-552-g2fad488
encint.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static int chmc_encint_len (const UInt32 val)
 
static int chmc_encint (const UInt32 val, UChar *out)
 
static int chmc_decint (const UChar *in, UInt32 *value)
 

Function Documentation

◆ chmc_decint()

static int chmc_decint ( const UChar in,
UInt32 value 
)
inlinestatic

Definition at line 78 of file encint.h.

78  {
79  int len;
80 
81  len = 0;
82  *value = 0;
83 
84  while ( (in[len] & 0x80) && (len < 3) ) {
85  *value <<= 7;
86  *value |= in[len] & 0x7f;
87  len++;
88  }
89  *value <<= 7;
90  *value |= in[len] & 0x7f;
91  len++;
92 
93  return len;
94 }
GLenum GLsizei len
Definition: glext.h:6722
GLuint in
Definition: glext.h:9616

Referenced by chmc_pmgi_done().

◆ chmc_encint()

static int chmc_encint ( const UInt32  val,
UChar out 
)
inlinestatic

Definition at line 46 of file encint.h.

46  {
47  int len;
48  UInt32 a;
49  UChar *p, *l;
50 
51  // FIXME should support 64 bit?
52  if ( ! out || val > 0xfffffffUL )
53  return 0; // FIXME can't handle, overflow
54 
55  if ( val > 0x1fffffUL )
56  len = 4;
57  else if ( val > 0x3fffUL )
58  len = 3;
59  else if ( val > 0x7fUL )
60  len = 2;
61  else
62  len = 1;
63 
64  a = val;
65  l = p = out + (len - 1);
66 
67  while ( p >= out ) {
68  *p = (a & 0x7fUL);
69  if ( p < l )
70  *p |= 0x80UL;
71  p--;
72  a >>= 7;
73  }
74 
75  return len;
76 }
DWORD UInt32
Definition: chm_lib.c:104
BYTE UChar
Definition: chm_lib.c:100
#define a
Definition: ke_i.h:78
GLuint GLfloat * val
Definition: glext.h:7180
r l[0]
Definition: byte_order.h:167
static FILE * out
Definition: regtests2xml.c:44
GLenum GLsizei len
Definition: glext.h:6722
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLfloat GLfloat p
Definition: glext.h:8902
#define UL
Definition: tui.h:83

Referenced by chmc_pmgi_add_entry(), and chmc_pmgl_add_entry().

◆ chmc_encint_len()

static int chmc_encint_len ( const UInt32  val)
inlinestatic

Definition at line 28 of file encint.h.

28  {
29  int len;
30 
31  // FIXME should support 64 bit?
32  if ( val > 0xfffffffUL )
33  len = 0; // overflow
34  else if ( val > 0x1fffffUL )
35  len = 4;
36  else if ( val > 0x3fffUL )
37  len = 3;
38  else if ( val > 0x7fUL )
39  len = 2;
40  else
41  len = 1;
42 
43  return len;
44 }
GLuint GLfloat * val
Definition: glext.h:7180
GLenum GLsizei len
Definition: glext.h:6722

Referenced by chmc_pmgi_add_entry(), and chmc_pmgl_add_entry().