List:Commits« Previous MessageNext Message »
From:jonas Date:April 2 2007 2:07pm
Subject:bk commit into 5.1 tree (jonas:1.2331)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-04-02 16:07:34+02:00, jonas@stripped +1 -0
  ndb - wl1190
    remove unsued method(setbits)
    fix lingering #if WORDS_BIG_ENDIAN that I missed in last commit/push

  storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp@stripped, 2007-04-02 16:07:32+02:00, jonas@stripped +19 -113
    remove unsued method
    fix lingering #if WORDS_BIG_ENDIAN that I missed in last commit/push

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jonas
# Host:	perch.ndb.mysql.com
# Root:	/home/jonas/src/51-wl1190

--- 1.33/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2007-04-02 16:07:39 +02:00
+++ 1.34/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp	2007-04-02 16:07:39 +02:00
@@ -911,92 +911,6 @@
                                        ahOut, attrDes2);
 }
 
-/*
-  The getbits() and setbits() functions handle the shuffling of bit
-  types in and out of the dynamic bitmaps. They are a bit special in
-  that they need to keep the first byte untouched (for the bitmap
-  length) as well as the last two bytes (to avoid padding), so they
-  need to shift from different directions depending on the host
-  endianness.
- */
-
-static void
-setbits(const Uint32 *src, Uint32 *dst, Uint32 bit_pos, Uint32 count)
-{
-  Uint32 val;
-
-  /* Move to start word in dst. */
-
-  dst+= bit_pos>>5;
-  bit_pos&= 31;
-
-#ifdef WORDS_BIGENDIAN
-  Uint32 low_mask= ((Uint32)0xffffffff)<<(32-bit_pos);
-  Uint32 high_mask= ~low_mask;
-#else
-  Uint32 low_mask= (((Uint32)1)<<bit_pos) - 1;
-  Uint32 high_mask= ~low_mask;
-#endif
-
-  if (bit_pos==0)
-  {
-    MEMCOPY_NO_WORDS(dst, src, count>>5);
-    src+= count>>5;
-    dst+= count>>5;
-    count&= 31;
-  }
-  else
-  {
-    while (count >= 32)
-    {
-      val= *src++;
-#ifdef WORDS_BIGENDIAN
-      *dst= (*dst&low_mask) | (val&high_mask);
-      dst++;
-      *dst= (*dst&high_mask) | (val&low_mask);
-#else
-      *dst= (*dst&low_mask) | (val<<bit_pos);
-      dst++;
-      *dst= (*dst&high_mask) | (val>>(32-bit_pos));
-#endif
-      count-= 32;
-    }
-  }
-
-  /* Handle any partial word at the end. */
-  if (count > 0)
-  {
-    val= *src;
-    if (bit_pos+count <= 32)
-    {
-      /* Remaining part fits in one word of destination. */
-      Uint32 end_mask= (((Uint32)1)<<count) - 1;
-#ifdef WORDS_BIGENDIAN
-      Uint32 shift= (32-(bit_pos+count));
-      *dst= (*dst&~(end_mask<<shift)) | ((val&end_mask)<<shift);
-#else
-      *dst= (*dst&~(end_mask<<bit_pos)) | ((val&end_mask)<<bit_pos);
-#endif
-    }
-    else
-    {
-      /* Need to split the remaining part across two destination words. */
-#ifdef WORDS_BIGENDIAN
-      *dst= (*dst&low_mask) | (val&high_mask);
-      dst++;
-      Uint32 shift= 32-count;
-      Uint32 end_mask= ((((Uint32)1)<<(bit_pos+count-32)) - 1) << (32-bit_pos);
-      *dst= (*dst&~(end_mask<<shift)) | ((val&end_mask)<<shift);
-#else
-      *dst= (*dst&low_mask) | (val<<bit_pos);
-      dst++;
-      Uint32 end_mask= (((Uint32)1)<<(count+bit_pos-32)) - 1;
-      *dst= (*dst&~end_mask) | ((val>>(32-bit_pos))&end_mask);
-#endif
-    }
-  }
-}
-
 bool
 Dbtup::readDynBitsNotNULL(Uint32* outBuffer,
                           KeyReqStruct *req_struct,
@@ -1834,7 +1748,9 @@
   Uint32 attrDescriptor= req_struct->attr_descriptor;
   Uint32 pos= AttributeOffset::getNullFlagPos(attrDes2);
   Uint32 nullbits= AttributeDescriptor::getSizeInWords(attrDescriptor);
-  Uint16 *bm_ptr= (Uint16 *)(req_struct->m_var_data[MM].m_dyn_data_ptr);
+  Uint32 *bm_ptr= (Uint32 *)(req_struct->m_var_data[MM].m_dyn_data_ptr);
+
+  ndbassert(nullbits && nullbits <= 16);
 
   /*
     Compute two 16-bit bitmasks and a 16-bit aligned bitmap offset for setting
@@ -1843,17 +1759,11 @@
     attributes are stored more efficiently as varsize internally anyway).
   */
 
-  Uint32 bm_idx= (pos >> 4);
-  /* Store bits in little-endian so fit with length byte and trailing padding */
-#ifdef WORDS_BIGENDIAN
-  Uint32 bm_mask= (((Uint32)0xffffffff) << (32 - nullbits)) >> (pos & 15);
-  Uint16 bm_mask1= bm_mask>>16;
-  Uint16 bm_mask2= bm_mask&0xffff;
-#else
-  Uint32 bm_mask= ( (((Uint32)1)<<nullbits)-1) << (pos & 15);
-  Uint16 bm_mask1= bm_mask&0xffff;
-  Uint16 bm_mask2= bm_mask>>16;
-#endif
+  Uint32 bm_idx= (pos >> 5);
+  /* Store bits in little-endian so fit with length byte and trailing padding*/
+  Uint64 bm_mask = ((Uint64(1) << nullbits) - 1) << (pos & 31);
+  Uint32 bm_mask1 = bm_mask & 0xFFFFFFFF;
+  Uint32 bm_mask2 = bm_mask >> 32;
 
   ljam();
   /* Set all the bits in the NULL bitmap. */
@@ -1893,7 +1803,9 @@
   Uint32 attrDescriptor= req_struct->attr_descriptor;
   Uint32 pos= AttributeOffset::getNullFlagPos(attrDes2);
   Uint32 nullbits= AttributeDescriptor::getSizeInWords(attrDescriptor);
-  Uint16 *bm_ptr= (Uint16 *)(req_struct->m_var_data[MM].m_dyn_data_ptr);
+  Uint32 *bm_ptr= (Uint32 *)(req_struct->m_var_data[MM].m_dyn_data_ptr);
+
+  ndbassert(nullbits && nullbits <= 16);
 
   /*
     Compute two 16-bit bitmasks and a 16-bit aligned bitmap offset for
@@ -1902,24 +1814,18 @@
     attributes are stored more efficiently as varsize internally anyway).
   */
 
-  Uint32 bm_idx= (pos >> 4);
-  /* Store bits in little-endian so fit with length byte and trailing padding */
-#ifdef WORDS_BIGENDIAN
-  Uint32 bm_mask= ~((((Uint32)0xffffffff) << (32 - nullbits)) >> (pos & 15));
-  Uint16 bm_mask1= bm_mask>>16;
-  Uint16 bm_mask2= bm_mask&0xffff;
-#else
-  Uint32 bm_mask= ~(( (((Uint32)1)<<nullbits)-1) << (pos & 15));
-  Uint16 bm_mask1= bm_mask&0xffff;
-  Uint16 bm_mask2= bm_mask>>16;
-#endif
-
+  Uint32 bm_idx= (pos >> 5);
+  /* Store bits in little-endian so fit with length byte and trailing padding*/
+  Uint64 bm_mask = ~(((Uint64(1) << nullbits) - 1) << (pos & 31));
+  Uint32 bm_mask1 = bm_mask & 0xFFFFFFFF;
+  Uint32 bm_mask2 = bm_mask >> 32;
+  
   Uint32 newIndex= req_struct->in_buf_index + 1;
   if (newIndex <= req_struct->in_buf_len) {
     ljam();
     /* Clear the bits in the NULL bitmap. */
-    bm_ptr[bm_idx]&= bm_mask1;
-    bm_ptr[bm_idx+1]&= bm_mask2;
+    bm_ptr[bm_idx] &= bm_mask1;
+    bm_ptr[bm_idx+1] &= bm_mask2;
     req_struct->in_buf_index= newIndex;
     return true;
   } else {
Thread
bk commit into 5.1 tree (jonas:1.2331)jonas2 Apr