~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/serialize/binlog_encoding.h

  • Committer: Brian Aker
  • Date: 2009-03-03 18:50:34 UTC
  • mfrom: (908.1.17 mordred)
  • Revision ID: brian@tangent.org-20090303185034-obr7tiwx8vyn0i7j
Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
  unsigned char *ptr= buf;
34
34
  assert(length > 1);
35
35
  if (length < 256)
36
 
    *ptr++= length & 0xFF;
 
36
    *ptr++= (unsigned char) (length & 0xFF);
37
37
  else {
38
38
    int_fast8_t log2m1= -1;        // ceil(log2(ptr - buf)) - 1
39
39
    uint_fast8_t pow2= 1;          // pow2(log2m1 + 1)
45
45
      // Write the least significant byte of the current
46
46
      // length. Prefix increment is used to make space for the first
47
47
      // byte that will hold log2m1.
48
 
      *++ptr= length & 0xFF;
 
48
      *++ptr= (unsigned char)length & 0xFF;
49
49
      length >>= 8;
50
50
 
51
51
      // Ensure the invariant holds by correcting it if it doesn't,