~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/binlog_encoding.h

Merged in latest plugin-slot-reorg.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
  {
41
41
    int_fast8_t log2m1= -1;        // ceil(log2(ptr - buf)) - 1
42
42
    uint_fast8_t pow2= 1;          // pow2(log2m1 + 1)
43
 
    while (length > 0) {
 
43
    while (length > 0) 
 
44
    {
44
45
      // Check the invariants
45
46
      assert((static_cast<int_fast8_t>(pow2)) == (1 << (log2m1 + 1)));
46
47
      assert((ptr - buf) <= (1 << (log2m1 + 1)));
54
55
      // Ensure the invariant holds by correcting it if it doesn't,
55
56
      // that is, the number of bytes written is greater than the
56
57
      // nearest power of two.
57
 
      if (ptr - buf > pow2) {
 
58
      if (ptr - buf > pow2) 
 
59
      {
58
60
        ++log2m1;
59
 
        pow2 <<= 1;
 
61
        pow2= static_cast<int_fast8_t>(pow2 << 1);
60
62
      }
61
63
    }
62
64
    // Clear the remaining bytes up to the next power of two
70
72
inline unsigned char *
71
73
length_decode(unsigned char *buf, std::size_t *plen)
72
74
{
73
 
  if (*buf > 1) {
 
75
  if (*buf > 1) 
 
76
  {
74
77
    *plen = *buf;
75
78
    return buf + 1;
76
79
  }