List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:January 11 2012 10:24am
Subject:bzr push into mysql-trunk branch (tor.didriksen:3718 to 3720)
View as plain text  
 3720 Tor Didriksen	2012-01-11
      fix compile warning: may be used uninitialized

    modified:
      client/mysqldump.c
 3719 Tor Didriksen	2012-01-11
      Cleanup of byteorder store/get #ifdef stuff.
      Add new optimized macros for __x86_64__ 
     @ config.h.cmake
        #define NOMINMAX to avoid getting min/max macros on windows.
     @ include/CMakeLists.txt
        New header files, containing code that used to be in my_global.h
     @ libmysqld/emb_qcache.cc
        Avoid type-punning warning.
     @ sql/binlog.cc
        Avoid type-punning warning.
     @ sql/ha_partition.cc
        Avoid type-punning warning.
     @ sql/log_event.cc
        Avoid type-punning warning.
     @ sql/rpl_slave.cc
        Avoid type-punning warning.
     @ sql/spatial.cc
        Avoid type-punning warning.
     @ sql/sql_join_buffer.h
        Fix compile error in visual studio.
     @ sql/unireg.cc
        Avoid type-punning warning.
     @ storage/archive/ha_archive.cc
        Avoid type-punning warning.
     @ unittest/gunit/CMakeLists.txt
        New unit tests

    added:
      include/byteorder/
      include/byteorder/big_endian.h
      include/byteorder/byte_order_generic.h
      include/byteorder/byte_order_generic_x86.h
      include/byteorder/byte_order_generic_x86_64.h
      include/byteorder/little_endian.h
      include/my_byteorder.h
      unittest/gunit/alignment-t.cc
      unittest/gunit/byteorder-t.cc
    modified:
      config.h.cmake
      include/CMakeLists.txt
      include/my_global.h
      libmysqld/emb_qcache.cc
      sql/binlog.cc
      sql/ha_partition.cc
      sql/log_event.cc
      sql/rpl_slave.cc
      sql/spatial.cc
      sql/sql_join_buffer.h
      sql/unireg.cc
      storage/archive/ha_archive.cc
      unittest/gunit/CMakeLists.txt
 3718 Nirbhay Choubey	2012-01-10 [merge]
      Merge of fix for bug#11760384 from mysql-5.5.

    modified:
      client/mysqldump.c
      mysql-test/r/mysqldump.result
      mysql-test/t/mysqldump.test
=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2012-01-10 10:50:22 +0000
+++ b/client/mysqldump.c	2012-01-11 10:07:45 +0000
@@ -1867,7 +1867,7 @@ static void print_xml_row(FILE *xml_file
 {
   uint i;
   my_bool body_found= 0;
-  char *create_stmt_ptr;
+  char *create_stmt_ptr= NULL;
   ulong create_stmt_len= 0;
   MYSQL_FIELD *field;
   ulong *lengths= mysql_fetch_lengths(tableRes);

=== modified file 'config.h.cmake'
--- a/config.h.cmake	2011-11-18 12:28:10 +0000
+++ b/config.h.cmake	2012-01-11 09:33:52 +0000
@@ -498,8 +498,10 @@
 # define HAVE_SETENV
 #define setenv(a,b,c) _putenv_s(a,b)
 #endif
-
-
+/* We don't want the min/max macros */
+#ifdef __WIN__
+#define NOMINMAX
+#endif
 
 
 /*

=== modified file 'include/CMakeLists.txt'
--- a/include/CMakeLists.txt	2011-11-01 16:33:58 +0000
+++ b/include/CMakeLists.txt	2012-01-11 09:33:52 +0000
@@ -55,6 +55,11 @@ SET(HEADERS 
   my_attribute.h 
   my_compiler.h
   mysql_com_server.h
+  my_byteorder.h
+  byteorder/byte_order_generic_x86.h
+  byteorder/little_endian.h
+  byteorder/byte_order_generic.h
+  byteorder/big_endian.h
   ${HEADERS_GEN_CONFIGURE}
 )
 

=== added directory 'include/byteorder'
=== added file 'include/byteorder/big_endian.h'
--- a/include/byteorder/big_endian.h	1970-01-01 00:00:00 +0000
+++ b/include/byteorder/big_endian.h	2012-01-11 09:33:52 +0000
@@ -0,0 +1,82 @@
+/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA */
+
+/*
+  Data in big-endian format.
+*/
+#define float4store(T,A) do { *(T)= ((uchar *) &A)[3];\
+                              *((T)+1)=(char) ((uchar *) &A)[2];\
+                              *((T)+2)=(char) ((uchar *) &A)[1];\
+                              *((T)+3)=(char) ((uchar *) &A)[0]; } while(0)
+
+#define float4get(V,M)   do { float def_temp;\
+                              ((uchar*) &def_temp)[0]=(M)[3];\
+                              ((uchar*) &def_temp)[1]=(M)[2];\
+                              ((uchar*) &def_temp)[2]=(M)[1];\
+                              ((uchar*) &def_temp)[3]=(M)[0];\
+                              (V)=def_temp; } while(0)
+
+#define float8store(T,V) do { *(T)= ((uchar *) &V)[7];\
+                              *((T)+1)=(char) ((uchar *) &V)[6];\
+                              *((T)+2)=(char) ((uchar *) &V)[5];\
+                              *((T)+3)=(char) ((uchar *) &V)[4];\
+                              *((T)+4)=(char) ((uchar *) &V)[3];\
+                              *((T)+5)=(char) ((uchar *) &V)[2];\
+                              *((T)+6)=(char) ((uchar *) &V)[1];\
+                              *((T)+7)=(char) ((uchar *) &V)[0]; } while(0)
+
+#define float8get(V,M)   do { double def_temp;\
+                              ((uchar*) &def_temp)[0]=(M)[7];\
+                              ((uchar*) &def_temp)[1]=(M)[6];\
+                              ((uchar*) &def_temp)[2]=(M)[5];\
+                              ((uchar*) &def_temp)[3]=(M)[4];\
+                              ((uchar*) &def_temp)[4]=(M)[3];\
+                              ((uchar*) &def_temp)[5]=(M)[2];\
+                              ((uchar*) &def_temp)[6]=(M)[1];\
+                              ((uchar*) &def_temp)[7]=(M)[0];\
+                              (V) = def_temp; } while(0)
+
+#define ushortget(V,M)  do { V = (uint16) (((uint16) ((uchar) (M)[1]))+\
+                                 ((uint16) ((uint16) (M)[0]) << 8)); } while(0)
+#define shortget(V,M)   do { V = (short) (((short) ((uchar) (M)[1]))+\
+                                 ((short) ((short) (M)[0]) << 8)); } while(0)
+#define longget(V,M)    do { int32 def_temp;\
+                             ((uchar*) &def_temp)[0]=(M)[0];\
+                             ((uchar*) &def_temp)[1]=(M)[1];\
+                             ((uchar*) &def_temp)[2]=(M)[2];\
+                             ((uchar*) &def_temp)[3]=(M)[3];\
+                             (V)=def_temp; } while(0)
+#define ulongget(V,M)   do { uint32 def_temp;\
+                            ((uchar*) &def_temp)[0]=(M)[0];\
+                            ((uchar*) &def_temp)[1]=(M)[1];\
+                            ((uchar*) &def_temp)[2]=(M)[2];\
+                            ((uchar*) &def_temp)[3]=(M)[3];\
+                            (V)=def_temp; } while(0)
+#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\
+                             *(((char*)T)+1)=(char)(def_temp); \
+                             *(((char*)T)+0)=(char)(def_temp >> 8); } while(0)
+#define longstore(T,A)  do { *(((char*)T)+3)=((A));\
+                             *(((char*)T)+2)=(((A) >> 8));\
+                             *(((char*)T)+1)=(((A) >> 16));\
+                             *(((char*)T)+0)=(((A) >> 24)); } while(0)
+
+#define floatget(V,M)      memcpy(&V, (M), sizeof(float))
+/* Cast away type qualifiers (necessary as macro takes argument by value). */
+#define floatstore(T,V)    memcpy((T), (void*) (&V), sizeof(float))
+#define doubleget(V,M)     memcpy(&V, (M), sizeof(double))
+/* Cast away type qualifiers (necessary as macro takes argument by value). */
+#define doublestore(T,V)   memcpy((T), (void*) &V, sizeof(double))
+#define longlongget(V,M)   memcpy(&V, (M), sizeof(ulonglong))
+#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong))

=== added file 'include/byteorder/byte_order_generic.h'
--- a/include/byteorder/byte_order_generic.h	1970-01-01 00:00:00 +0000
+++ b/include/byteorder/byte_order_generic.h	2012-01-11 09:33:52 +0000
@@ -0,0 +1,95 @@
+/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA */
+
+/*
+  Endianness-independent definitions for architectures other
+  than the x86 architecture.
+*/
+#define sint2korr(A)	(int16) (((int16) ((uchar) (A)[0])) +\
+				 ((int16) ((int16) (A)[1]) << 8))
+#define sint3korr(A)	((int32) ((((uchar) (A)[2]) & 128) ? \
+				  (((uint32) 255L << 24) | \
+				   (((uint32) (uchar) (A)[2]) << 16) |\
+				   (((uint32) (uchar) (A)[1]) << 8) | \
+				   ((uint32) (uchar) (A)[0])) : \
+				  (((uint32) (uchar) (A)[2]) << 16) |\
+				  (((uint32) (uchar) (A)[1]) << 8) | \
+				  ((uint32) (uchar) (A)[0])))
+#define sint4korr(A)	(int32) (((int32) ((uchar) (A)[0])) +\
+				(((int32) ((uchar) (A)[1]) << 8)) +\
+				(((int32) ((uchar) (A)[2]) << 16)) +\
+				(((int32) ((int16) (A)[3]) << 24)))
+#define sint8korr(A)	(longlong) uint8korr(A)
+#define uint2korr(A)	(uint16) (((uint16) ((uchar) (A)[0])) +\
+				  ((uint16) ((uchar) (A)[1]) << 8))
+#define uint3korr(A)	(uint32) (((uint32) ((uchar) (A)[0])) +\
+				  (((uint32) ((uchar) (A)[1])) << 8) +\
+				  (((uint32) ((uchar) (A)[2])) << 16))
+#define uint4korr(A)	(uint32) (((uint32) ((uchar) (A)[0])) +\
+				  (((uint32) ((uchar) (A)[1])) << 8) +\
+				  (((uint32) ((uchar) (A)[2])) << 16) +\
+				  (((uint32) ((uchar) (A)[3])) << 24))
+#define uint5korr(A)	((ulonglong)(((uint32) ((uchar) (A)[0])) +\
+				    (((uint32) ((uchar) (A)[1])) << 8) +\
+				    (((uint32) ((uchar) (A)[2])) << 16) +\
+				    (((uint32) ((uchar) (A)[3])) << 24)) +\
+				    (((ulonglong) ((uchar) (A)[4])) << 32))
+#define uint6korr(A)	((ulonglong)(((uint32)    ((uchar) (A)[0]))          + \
+                                     (((uint32)    ((uchar) (A)[1])) << 8)   + \
+                                     (((uint32)    ((uchar) (A)[2])) << 16)  + \
+                                     (((uint32)    ((uchar) (A)[3])) << 24)) + \
+                         (((ulonglong) ((uchar) (A)[4])) << 32) +       \
+                         (((ulonglong) ((uchar) (A)[5])) << 40))
+#define uint8korr(A)	((ulonglong)(((uint32) ((uchar) (A)[0])) +\
+				    (((uint32) ((uchar) (A)[1])) << 8) +\
+				    (((uint32) ((uchar) (A)[2])) << 16) +\
+				    (((uint32) ((uchar) (A)[3])) << 24)) +\
+			(((ulonglong) (((uint32) ((uchar) (A)[4])) +\
+				    (((uint32) ((uchar) (A)[5])) << 8) +\
+				    (((uint32) ((uchar) (A)[6])) << 16) +\
+				    (((uint32) ((uchar) (A)[7])) << 24))) <<\
+				    32))
+#define int2store(T,A)       do { uint def_temp= (uint) (A) ;\
+                                  *((uchar*) (T))=  (uchar)(def_temp); \
+                                   *((uchar*) (T)+1)=(uchar)((def_temp >> 8)); \
+                             } while(0)
+#define int3store(T,A)       do { /*lint -save -e734 */\
+                                  *((uchar*)(T))=(uchar) ((A));\
+                                  *((uchar*) (T)+1)=(uchar) (((A) >> 8));\
+                                  *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \
+                                  /*lint -restore */} while(0)
+#define int4store(T,A)       do { *((char *)(T))=(char) ((A));\
+                                  *(((char *)(T))+1)=(char) (((A) >> 8));\
+                                  *(((char *)(T))+2)=(char) (((A) >> 16));\
+                                  *(((char *)(T))+3)=(char) (((A) >> 24));\
+                             } while(0)
+#define int5store(T,A)       do { *((char *)(T))=     (char)((A));  \
+                                  *(((char *)(T))+1)= (char)(((A) >> 8)); \
+                                  *(((char *)(T))+2)= (char)(((A) >> 16)); \
+                                  *(((char *)(T))+3)= (char)(((A) >> 24)); \
+                                  *(((char *)(T))+4)= (char)(((A) >> 32)); \
+		             } while(0)
+#define int6store(T,A)       do { *((char *)(T))=     (char)((A)); \
+                                  *(((char *)(T))+1)= (char)(((A) >> 8)); \
+                                  *(((char *)(T))+2)= (char)(((A) >> 16)); \
+                                  *(((char *)(T))+3)= (char)(((A) >> 24)); \
+                                  *(((char *)(T))+4)= (char)(((A) >> 32)); \
+                                  *(((char *)(T))+5)= (char)(((A) >> 40)); \
+                             } while(0)
+#define int8store(T,A)       do { uint def_temp= (uint) (A), \
+                                       def_temp2= (uint) ((A) >> 32); \
+                                  int4store((T),def_temp); \
+                                  int4store((T+4),def_temp2);\
+                             } while(0)

=== added file 'include/byteorder/byte_order_generic_x86.h'
--- a/include/byteorder/byte_order_generic_x86.h	1970-01-01 00:00:00 +0000
+++ b/include/byteorder/byte_order_generic_x86.h	2012-01-11 09:33:52 +0000
@@ -0,0 +1,93 @@
+/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA */
+
+/*
+  Optimized function-like macros for the x86 architecture (_WIN32 included).
+*/
+#define sint2korr(A)	(*((int16 *) (A)))
+#define sint3korr(A)	((int32) ((((uchar) (A)[2]) & 128) ? \
+				  (((uint32) 255L << 24) | \
+				   (((uint32) (uchar) (A)[2]) << 16) |\
+				   (((uint32) (uchar) (A)[1]) << 8) | \
+				   ((uint32) (uchar) (A)[0])) : \
+				  (((uint32) (uchar) (A)[2]) << 16) |\
+				  (((uint32) (uchar) (A)[1]) << 8) | \
+				  ((uint32) (uchar) (A)[0])))
+#define sint4korr(A)	(*((long *) (A)))
+#define uint2korr(A)	(*((uint16 *) (A)))
+/*
+  Attention: Please, note, uint3korr reads 4 bytes (not 3)!
+  It means, that you have to provide enough allocated space.
+*/
+#if defined(HAVE_purify) && !defined(_WIN32)
+#define uint3korr(A)	(uint32) (((uint32) ((uchar) (A)[0])) +\
+				  (((uint32) ((uchar) (A)[1])) << 8) +\
+				  (((uint32) ((uchar) (A)[2])) << 16))
+#else
+#define uint3korr(A)	(long) (*((unsigned int *) (A)) & 0xFFFFFF)
+#endif
+#define uint4korr(A)	(*((uint32 *) (A)))
+#define uint5korr(A)	((ulonglong)(((uint32) ((uchar) (A)[0])) +\
+				    (((uint32) ((uchar) (A)[1])) << 8) +\
+				    (((uint32) ((uchar) (A)[2])) << 16) +\
+				    (((uint32) ((uchar) (A)[3])) << 24)) +\
+				    (((ulonglong) ((uchar) (A)[4])) << 32))
+#define uint6korr(A)	((ulonglong)(((uint32)    ((uchar) (A)[0]))          + \
+                                     (((uint32)    ((uchar) (A)[1])) << 8)   + \
+                                     (((uint32)    ((uchar) (A)[2])) << 16)  + \
+                                     (((uint32)    ((uchar) (A)[3])) << 24)) + \
+                         (((ulonglong) ((uchar) (A)[4])) << 32) +       \
+                         (((ulonglong) ((uchar) (A)[5])) << 40))
+#define uint8korr(A)	(*((ulonglong *) (A)))
+#define sint8korr(A)	(*((longlong *) (A)))
+
+#define int2store(T,A)	*((uint16*) (T))= (uint16) (A)
+#define int3store(T,A)  do { *(T)=  (uchar) ((A));\
+                            *(T+1)=(uchar) (((uint) (A) >> 8));\
+                            *(T+2)=(uchar) (((A) >> 16));\
+                        } while (0)
+#define int4store(T,A)	*((long *) (T))= (long) (A)
+#define int5store(T,A)  do { *(T)= (uchar)((A));\
+                             *((T)+1)=(uchar) (((A) >> 8));\
+                             *((T)+2)=(uchar) (((A) >> 16));\
+                             *((T)+3)=(uchar) (((A) >> 24));\
+                             *((T)+4)=(uchar) (((A) >> 32));\
+                        } while(0)
+#define int6store(T,A)  do { *(T)=    (uchar)((A));          \
+                             *((T)+1)=(uchar) (((A) >> 8));  \
+                             *((T)+2)=(uchar) (((A) >> 16)); \
+                             *((T)+3)=(uchar) (((A) >> 24)); \
+                             *((T)+4)=(uchar) (((A) >> 32)); \
+                             *((T)+5)=(uchar) (((A) >> 40)); \
+                        } while(0)
+#define int8store(T,A)	*((ulonglong *) (T))= (ulonglong) (A)
+typedef union {
+  double v;
+  long m[2];
+} doubleget_union;
+#define doubleget(V,M)	 do { doubleget_union _tmp; \
+                              _tmp.m[0] = *((long*)(M)); \
+                              _tmp.m[1] = *(((long*) (M))+1); \
+                              (V) = _tmp.v;\
+                         } while(0)
+#define doublestore(T,V) do { *((long *) T) = ((doubleget_union *)&V)->m[0]; \
+			     *(((long *) T)+1) = ((doubleget_union *)&V)->m[1];\
+                         } while (0)
+#define float4get(V,M)   do { *((float *) &(V)) = *((float*) (M)); } while(0)
+#define float8get(V,M)   doubleget((V),(M))
+#define float4store(V,M) memcpy((uchar*)(V), (uchar*)(&M), sizeof(float))
+#define floatstore(T,V)  memcpy((uchar*)(T), (uchar*)(&V), sizeof(float))
+#define floatget(V,M)    memcpy((uchar*)(&V),(uchar*) (M), sizeof(float))
+#define float8store(V,M) doublestore((V),(M))

=== added file 'include/byteorder/byte_order_generic_x86_64.h'
--- a/include/byteorder/byte_order_generic_x86_64.h	1970-01-01 00:00:00 +0000
+++ b/include/byteorder/byte_order_generic_x86_64.h	2012-01-11 09:33:52 +0000
@@ -0,0 +1,74 @@
+/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA */
+
+/*
+  Optimized function-like macros for the x86 architecture (_WIN32 included).
+*/
+#define sint2korr(A)	(int16) (*((int16 *) (A)))
+#define sint3korr(A)	((int32) ((((uchar) (A)[2]) & 128) ? \
+				  (((uint32) 255L << 24) | \
+				   (((uint32) (uchar) (A)[2]) << 16) |\
+				   (((uint32) (uchar) (A)[1]) << 8) | \
+				   ((uint32) (uchar) (A)[0])) : \
+				  (((uint32) (uchar) (A)[2]) << 16) |\
+				  (((uint32) (uchar) (A)[1]) << 8) | \
+				  ((uint32) (uchar) (A)[0])))
+#define sint4korr(A)	(int32)  (*((int32 *) (A)))
+#define uint2korr(A)	(uint16) (*((uint16 *) (A)))
+#define uint3korr(A)	(uint32) (*((unsigned int *) (A)) & 0xFFFFFF)
+#define uint4korr(A)	(uint32) (*((uint32 *) (A)))
+#define uint5korr(A)	((ulonglong)(((uint32) ((uchar) (A)[0])) +\
+				    (((uint32) ((uchar) (A)[1])) << 8) +\
+				    (((uint32) ((uchar) (A)[2])) << 16) +\
+				    (((uint32) ((uchar) (A)[3])) << 24)) +\
+				    (((ulonglong) ((uchar) (A)[4])) << 32))
+#define uint6korr(A)	((ulonglong)(((uint32)    ((uchar) (A)[0]))          + \
+                                     (((uint32)    ((uchar) (A)[1])) << 8)   + \
+                                     (((uint32)    ((uchar) (A)[2])) << 16)  + \
+                                     (((uint32)    ((uchar) (A)[3])) << 24)) + \
+                         (((ulonglong) ((uchar) (A)[4])) << 32) +       \
+                         (((ulonglong) ((uchar) (A)[5])) << 40))
+#define uint8korr(A)	(ulonglong) (*((ulonglong *) (A)))
+#define sint8korr(A)	(longlong) (*((longlong *) (A)))
+
+#define int2store(T,A)	do { uchar *pT= (uchar*)(T);\
+                             *((uint16*)(pT))= (uint16) (A);\
+                        } while (0)
+  
+#define int3store(T,A)  do { *(T)=  (uchar) ((A));\
+                            *(T+1)=(uchar) (((uint) (A) >> 8));\
+                            *(T+2)=(uchar) (((A) >> 16));\
+                        } while (0)
+#define int4store(T,A)	do { uchar *pT= (uchar*)(T);\
+                             *((uint32 *) (pT))= (uint32) (A); \
+                        } while (0)
+
+#define int5store(T,A)  do { *(T)= (uchar)((A));\
+                             *((T)+1)=(uchar) (((A) >> 8));\
+                             *((T)+2)=(uchar) (((A) >> 16));\
+                             *((T)+3)=(uchar) (((A) >> 24));\
+                             *((T)+4)=(uchar) (((A) >> 32));\
+                        } while(0)
+#define int6store(T,A)  do { *(T)=    (uchar)((A));          \
+                             *((T)+1)=(uchar) (((A) >> 8));  \
+                             *((T)+2)=(uchar) (((A) >> 16)); \
+                             *((T)+3)=(uchar) (((A) >> 24)); \
+                             *((T)+4)=(uchar) (((A) >> 32)); \
+                             *((T)+5)=(uchar) (((A) >> 40)); \
+                        } while(0)
+#define int8store(T,A)	do { uchar *pT= (uchar*)(T);\
+                             *((ulonglong *) (pT))= (ulonglong) (A);\
+                        } while(0)
+

=== added file 'include/byteorder/little_endian.h'
--- a/include/byteorder/little_endian.h	1970-01-01 00:00:00 +0000
+++ b/include/byteorder/little_endian.h	2012-01-11 09:33:52 +0000
@@ -0,0 +1,71 @@
+/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA */
+
+/*
+  Data in little-endian format.
+*/
+
+#ifndef MY_BYTE_ORDER_ARCH_OPTIMIZED
+#define float4get(V,M)   memcpy(&V, (M), sizeof(float))
+#define float4store(V,M) memcpy(V, (&M), sizeof(float))
+#define float8get(V,M)   doubleget((V),(M))
+#define float8store(V,M) doublestore((V),(M))
+
+/* Bi-endian hardware.... */
+#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
+#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\
+                              *(((char*)T)+1)=(char) ((uchar *) &V)[5];\
+                              *(((char*)T)+2)=(char) ((uchar *) &V)[6];\
+                              *(((char*)T)+3)=(char) ((uchar *) &V)[7];\
+                              *(((char*)T)+4)=(char) ((uchar *) &V)[0];\
+                              *(((char*)T)+5)=(char) ((uchar *) &V)[1];\
+                              *(((char*)T)+6)=(char) ((uchar *) &V)[2];\
+                              *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\
+                         while(0)
+#define doubleget(V,M)   do { double def_temp;\
+                              ((uchar*) &def_temp)[0]=(M)[4];\
+                              ((uchar*) &def_temp)[1]=(M)[5];\
+                              ((uchar*) &def_temp)[2]=(M)[6];\
+                              ((uchar*) &def_temp)[3]=(M)[7];\
+                              ((uchar*) &def_temp)[4]=(M)[0];\
+                              ((uchar*) &def_temp)[5]=(M)[1];\
+                              ((uchar*) &def_temp)[6]=(M)[2];\
+                              ((uchar*) &def_temp)[7]=(M)[3];\
+                              (V) = def_temp; } while(0)
+#else /* Bi-endian hardware.... */
+
+/* Cast away type qualifiers (necessary as macro takes argument by value). */
+#define doublestore(T,V) memcpy((T), (void*) &V, sizeof(double))
+#define doubleget(V,M)	 memcpy(&V, (M), sizeof(double))
+
+#endif /* Bi-endian hardware.... */
+
+#endif /* !MY_BYTE_ORDER_ARCH_OPTIMIZED */
+
+#define ushortget(V,M)	do { uchar *pM= (uchar*)(M);V = uint2korr(pM);} while(0)
+#define shortget(V,M)	do { uchar *pM= (uchar*)(M);V = sint2korr(pM);} while(0)
+#define longget(V,M)	do { uchar *pM= (uchar*)(M);V = sint4korr(pM);} while(0)
+#define ulongget(V,M)   do { uchar *pM= (uchar*)(M);V = uint4korr(pM);} while(0)
+#define shortstore(T,V) int2store(T,V)
+#define longstore(T,V)	int4store(T,V)
+
+#ifndef floatstore
+/* Cast away type qualifiers (necessary as macro takes argument by value). */
+#define floatstore(T,V)  memcpy((T), (void*) (&V), sizeof(float))
+#define floatget(V,M)    memcpy(&V, (M), sizeof(float))
+#endif
+
+#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong))
+#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong))

=== added file 'include/my_byteorder.h'
--- a/include/my_byteorder.h	1970-01-01 00:00:00 +0000
+++ b/include/my_byteorder.h	2012-01-11 09:33:52 +0000
@@ -0,0 +1,54 @@
+#ifndef MY_BYTEORDER_INCLUDED
+#define MY_BYTEORDER_INCLUDED
+
+/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
+
+
+/*
+  Macro for reading 32-bit integer from network byte order (big-endian)
+  from a unaligned memory location.
+*/
+#define int4net(A)        (int32) (((uint32) ((uchar) (A)[3]))        | \
+                                  (((uint32) ((uchar) (A)[2])) << 8)  | \
+                                  (((uint32) ((uchar) (A)[1])) << 16) | \
+                                  (((uint32) ((uchar) (A)[0])) << 24))
+
+/*
+  Function-like macros for reading and storing in machine independent
+  format (low byte first). There are 'korr' (assume 'corrector') variants
+  for integer types, but 'get' (assume 'getter') for floating point types.
+*/
+#if defined(__i386__) || defined(_WIN32)
+#define MY_BYTE_ORDER_ARCH_OPTIMIZED
+#include "byteorder/byte_order_generic_x86.h"
+#elif defined(__x86_64__)
+#include "byteorder/byte_order_generic_x86_64.h"
+#else
+#include "byteorder/byte_order_generic.h"
+#endif
+
+/*
+  Function-like macros for reading and storing in machine format from/to
+  short/long to/from some place in memory V should be a variable (not on
+  a register) and M a pointer to byte.
+*/
+#ifdef WORDS_BIGENDIAN
+#include "byteorder/big_endian.h"
+#else
+#include "byteorder/little_endian.h"
+#endif
+
+#endif /* MY_BYTEORDER_INCLUDED */

=== modified file 'include/my_global.h'
--- a/include/my_global.h	2011-11-28 10:08:20 +0000
+++ b/include/my_global.h	2012-01-11 09:33:52 +0000
@@ -1029,298 +1029,7 @@ typedef char		my_bool; /* Small bool */
 #define MY_HOW_OFTEN_TO_ALARM	2	/* How often we want info on screen */
 #define MY_HOW_OFTEN_TO_WRITE	1000	/* How often we want info on screen */
 
-
-
-/*
-  Define-funktions for reading and storing in machine independent format
-  (low byte first)
-*/
-
-/* Optimized store functions for Intel x86 */
-#if defined(__i386__) || defined(_WIN32)
-#define sint2korr(A)	(*((int16 *) (A)))
-#define sint3korr(A)	((int32) ((((uchar) (A)[2]) & 128) ? \
-				  (((uint32) 255L << 24) | \
-				   (((uint32) (uchar) (A)[2]) << 16) |\
-				   (((uint32) (uchar) (A)[1]) << 8) | \
-				   ((uint32) (uchar) (A)[0])) : \
-				  (((uint32) (uchar) (A)[2]) << 16) |\
-				  (((uint32) (uchar) (A)[1]) << 8) | \
-				  ((uint32) (uchar) (A)[0])))
-#define sint4korr(A)	(*((long *) (A)))
-#define uint2korr(A)	(*((uint16 *) (A)))
-#if defined(HAVE_purify) && !defined(_WIN32)
-#define uint3korr(A)	(uint32) (((uint32) ((uchar) (A)[0])) +\
-				  (((uint32) ((uchar) (A)[1])) << 8) +\
-				  (((uint32) ((uchar) (A)[2])) << 16))
-#else
-/*
-   ATTENTION !
-   
-    Please, note, uint3korr reads 4 bytes (not 3) !
-    It means, that you have to provide enough allocated space !
-*/
-#define uint3korr(A)	(long) (*((unsigned int *) (A)) & 0xFFFFFF)
-#endif /* HAVE_purify && !_WIN32 */
-#define uint4korr(A)	(*((uint32 *) (A)))
-#define uint5korr(A)	((ulonglong)(((uint32) ((uchar) (A)[0])) +\
-				    (((uint32) ((uchar) (A)[1])) << 8) +\
-				    (((uint32) ((uchar) (A)[2])) << 16) +\
-				    (((uint32) ((uchar) (A)[3])) << 24)) +\
-				    (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint6korr(A)	((ulonglong)(((uint32)    ((uchar) (A)[0]))          + \
-                                     (((uint32)    ((uchar) (A)[1])) << 8)   + \
-                                     (((uint32)    ((uchar) (A)[2])) << 16)  + \
-                                     (((uint32)    ((uchar) (A)[3])) << 24)) + \
-                         (((ulonglong) ((uchar) (A)[4])) << 32) +       \
-                         (((ulonglong) ((uchar) (A)[5])) << 40))
-#define uint8korr(A)	(*((ulonglong *) (A)))
-#define sint8korr(A)	(*((longlong *) (A)))
-#define int2store(T,A)	*((uint16*) (T))= (uint16) (A)
-#define int3store(T,A)  do { *(T)=  (uchar) ((A));\
-                            *(T+1)=(uchar) (((uint) (A) >> 8));\
-                            *(T+2)=(uchar) (((A) >> 16)); } while (0)
-#define int4store(T,A)	*((long *) (T))= (long) (A)
-#define int5store(T,A)  do { *(T)= (uchar)((A));\
-                             *((T)+1)=(uchar) (((A) >> 8));\
-                             *((T)+2)=(uchar) (((A) >> 16));\
-                             *((T)+3)=(uchar) (((A) >> 24)); \
-                             *((T)+4)=(uchar) (((A) >> 32)); } while(0)
-#define int6store(T,A)  do { *(T)=    (uchar)((A));          \
-                             *((T)+1)=(uchar) (((A) >> 8));  \
-                             *((T)+2)=(uchar) (((A) >> 16)); \
-                             *((T)+3)=(uchar) (((A) >> 24)); \
-                             *((T)+4)=(uchar) (((A) >> 32)); \
-                             *((T)+5)=(uchar) (((A) >> 40)); } while(0)
-#define int8store(T,A)	*((ulonglong *) (T))= (ulonglong) (A)
-
-typedef union {
-  double v;
-  long m[2];
-} doubleget_union;
-#define doubleget(V,M)	\
-do { doubleget_union _tmp; \
-     _tmp.m[0] = *((long*)(M)); \
-     _tmp.m[1] = *(((long*) (M))+1); \
-     (V) = _tmp.v; } while(0)
-#define doublestore(T,V) do { *((long *) T) = ((doubleget_union *)&V)->m[0]; \
-			     *(((long *) T)+1) = ((doubleget_union *)&V)->m[1]; \
-                         } while (0)
-#define float4get(V,M)   do { *((float *) &(V)) = *((float*) (M)); } while(0)
-#define float8get(V,M)   doubleget((V),(M))
-#define float4store(V,M) memcpy((uchar*) V,(uchar*) (&M),sizeof(float))
-#define floatstore(T,V)  memcpy((uchar*)(T), (uchar*)(&V),sizeof(float))
-#define floatget(V,M)    memcpy((uchar*) &V,(uchar*) (M),sizeof(float))
-#define float8store(V,M) doublestore((V),(M))
-#else
-
-/*
-  We're here if it's not a IA-32 architecture (Win32 and UNIX IA-32 defines
-  were done before)
-*/
-#define sint2korr(A)	(int16) (((int16) ((uchar) (A)[0])) +\
-				 ((int16) ((int16) (A)[1]) << 8))
-#define sint3korr(A)	((int32) ((((uchar) (A)[2]) & 128) ? \
-				  (((uint32) 255L << 24) | \
-				   (((uint32) (uchar) (A)[2]) << 16) |\
-				   (((uint32) (uchar) (A)[1]) << 8) | \
-				   ((uint32) (uchar) (A)[0])) : \
-				  (((uint32) (uchar) (A)[2]) << 16) |\
-				  (((uint32) (uchar) (A)[1]) << 8) | \
-				  ((uint32) (uchar) (A)[0])))
-#define sint4korr(A)	(int32) (((int32) ((uchar) (A)[0])) +\
-				(((int32) ((uchar) (A)[1]) << 8)) +\
-				(((int32) ((uchar) (A)[2]) << 16)) +\
-				(((int32) ((int16) (A)[3]) << 24)))
-#define sint8korr(A)	(longlong) uint8korr(A)
-#define uint2korr(A)	(uint16) (((uint16) ((uchar) (A)[0])) +\
-				  ((uint16) ((uchar) (A)[1]) << 8))
-#define uint3korr(A)	(uint32) (((uint32) ((uchar) (A)[0])) +\
-				  (((uint32) ((uchar) (A)[1])) << 8) +\
-				  (((uint32) ((uchar) (A)[2])) << 16))
-#define uint4korr(A)	(uint32) (((uint32) ((uchar) (A)[0])) +\
-				  (((uint32) ((uchar) (A)[1])) << 8) +\
-				  (((uint32) ((uchar) (A)[2])) << 16) +\
-				  (((uint32) ((uchar) (A)[3])) << 24))
-#define uint5korr(A)	((ulonglong)(((uint32) ((uchar) (A)[0])) +\
-				    (((uint32) ((uchar) (A)[1])) << 8) +\
-				    (((uint32) ((uchar) (A)[2])) << 16) +\
-				    (((uint32) ((uchar) (A)[3])) << 24)) +\
-				    (((ulonglong) ((uchar) (A)[4])) << 32))
-#define uint6korr(A)	((ulonglong)(((uint32)    ((uchar) (A)[0]))          + \
-                                     (((uint32)    ((uchar) (A)[1])) << 8)   + \
-                                     (((uint32)    ((uchar) (A)[2])) << 16)  + \
-                                     (((uint32)    ((uchar) (A)[3])) << 24)) + \
-                         (((ulonglong) ((uchar) (A)[4])) << 32) +       \
-                         (((ulonglong) ((uchar) (A)[5])) << 40))
-#define uint8korr(A)	((ulonglong)(((uint32) ((uchar) (A)[0])) +\
-				    (((uint32) ((uchar) (A)[1])) << 8) +\
-				    (((uint32) ((uchar) (A)[2])) << 16) +\
-				    (((uint32) ((uchar) (A)[3])) << 24)) +\
-			(((ulonglong) (((uint32) ((uchar) (A)[4])) +\
-				    (((uint32) ((uchar) (A)[5])) << 8) +\
-				    (((uint32) ((uchar) (A)[6])) << 16) +\
-				    (((uint32) ((uchar) (A)[7])) << 24))) <<\
-				    32))
-#define int2store(T,A)       do { uint def_temp= (uint) (A) ;\
-                                  *((uchar*) (T))=  (uchar)(def_temp); \
-                                   *((uchar*) (T)+1)=(uchar)((def_temp >> 8)); \
-                             } while(0)
-#define int3store(T,A)       do { /*lint -save -e734 */\
-                                  *((uchar*)(T))=(uchar) ((A));\
-                                  *((uchar*) (T)+1)=(uchar) (((A) >> 8));\
-                                  *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \
-                                  /*lint -restore */} while(0)
-#define int4store(T,A)       do { *((char *)(T))=(char) ((A));\
-                                  *(((char *)(T))+1)=(char) (((A) >> 8));\
-                                  *(((char *)(T))+2)=(char) (((A) >> 16));\
-                                  *(((char *)(T))+3)=(char) (((A) >> 24)); } while(0)
-#define int5store(T,A)       do { *((char *)(T))=     (char)((A));  \
-                                  *(((char *)(T))+1)= (char)(((A) >> 8)); \
-                                  *(((char *)(T))+2)= (char)(((A) >> 16)); \
-                                  *(((char *)(T))+3)= (char)(((A) >> 24)); \
-                                  *(((char *)(T))+4)= (char)(((A) >> 32)); \
-		                } while(0)
-#define int6store(T,A)       do { *((char *)(T))=     (char)((A)); \
-                                  *(((char *)(T))+1)= (char)(((A) >> 8)); \
-                                  *(((char *)(T))+2)= (char)(((A) >> 16)); \
-                                  *(((char *)(T))+3)= (char)(((A) >> 24)); \
-                                  *(((char *)(T))+4)= (char)(((A) >> 32)); \
-                                  *(((char *)(T))+5)= (char)(((A) >> 40)); \
-                                } while(0)
-#define int8store(T,A)       do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \
-                                  int4store((T),def_temp); \
-                                  int4store((T+4),def_temp2); } while(0)
-#ifdef WORDS_BIGENDIAN
-#define float4store(T,A) do { *(T)= ((uchar *) &A)[3];\
-                              *((T)+1)=(char) ((uchar *) &A)[2];\
-                              *((T)+2)=(char) ((uchar *) &A)[1];\
-                              *((T)+3)=(char) ((uchar *) &A)[0]; } while(0)
-
-#define float4get(V,M)   do { float def_temp;\
-                              ((uchar*) &def_temp)[0]=(M)[3];\
-                              ((uchar*) &def_temp)[1]=(M)[2];\
-                              ((uchar*) &def_temp)[2]=(M)[1];\
-                              ((uchar*) &def_temp)[3]=(M)[0];\
-                              (V)=def_temp; } while(0)
-#define float8store(T,V) do { *(T)= ((uchar *) &V)[7];\
-                              *((T)+1)=(char) ((uchar *) &V)[6];\
-                              *((T)+2)=(char) ((uchar *) &V)[5];\
-                              *((T)+3)=(char) ((uchar *) &V)[4];\
-                              *((T)+4)=(char) ((uchar *) &V)[3];\
-                              *((T)+5)=(char) ((uchar *) &V)[2];\
-                              *((T)+6)=(char) ((uchar *) &V)[1];\
-                              *((T)+7)=(char) ((uchar *) &V)[0]; } while(0)
-
-#define float8get(V,M)   do { double def_temp;\
-                              ((uchar*) &def_temp)[0]=(M)[7];\
-                              ((uchar*) &def_temp)[1]=(M)[6];\
-                              ((uchar*) &def_temp)[2]=(M)[5];\
-                              ((uchar*) &def_temp)[3]=(M)[4];\
-                              ((uchar*) &def_temp)[4]=(M)[3];\
-                              ((uchar*) &def_temp)[5]=(M)[2];\
-                              ((uchar*) &def_temp)[6]=(M)[1];\
-                              ((uchar*) &def_temp)[7]=(M)[0];\
-                              (V) = def_temp; } while(0)
-#else
-#define float4get(V,M)   memcpy(&V, (M), sizeof(float))
-#define float4store(V,M) memcpy(V, (&M), sizeof(float))
-
-#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
-#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\
-                              *(((char*)T)+1)=(char) ((uchar *) &V)[5];\
-                              *(((char*)T)+2)=(char) ((uchar *) &V)[6];\
-                              *(((char*)T)+3)=(char) ((uchar *) &V)[7];\
-                              *(((char*)T)+4)=(char) ((uchar *) &V)[0];\
-                              *(((char*)T)+5)=(char) ((uchar *) &V)[1];\
-                              *(((char*)T)+6)=(char) ((uchar *) &V)[2];\
-                              *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\
-                         while(0)
-#define doubleget(V,M)   do { double def_temp;\
-                              ((uchar*) &def_temp)[0]=(M)[4];\
-                              ((uchar*) &def_temp)[1]=(M)[5];\
-                              ((uchar*) &def_temp)[2]=(M)[6];\
-                              ((uchar*) &def_temp)[3]=(M)[7];\
-                              ((uchar*) &def_temp)[4]=(M)[0];\
-                              ((uchar*) &def_temp)[5]=(M)[1];\
-                              ((uchar*) &def_temp)[6]=(M)[2];\
-                              ((uchar*) &def_temp)[7]=(M)[3];\
-                              (V) = def_temp; } while(0)
-#endif /* __FLOAT_WORD_ORDER */
-
-#define float8get(V,M)   doubleget((V),(M))
-#define float8store(V,M) doublestore((V),(M))
-#endif /* WORDS_BIGENDIAN */
-
-#endif /* __i386__ OR _WIN32 */
-
-/*
-  Macro for reading 32-bit integer from network byte order (big-endian)
-  from unaligned memory location.
-*/
-#define int4net(A)        (int32) (((uint32) ((uchar) (A)[3]))        |\
-				  (((uint32) ((uchar) (A)[2])) << 8)  |\
-				  (((uint32) ((uchar) (A)[1])) << 16) |\
-				  (((uint32) ((uchar) (A)[0])) << 24))
-/*
-  Define-funktions for reading and storing in machine format from/to
-  short/long to/from some place in memory V should be a (not
-  register) variable, M is a pointer to byte
-*/
-
-#ifdef WORDS_BIGENDIAN
-
-#define ushortget(V,M)  do { V = (uint16) (((uint16) ((uchar) (M)[1]))+\
-                                 ((uint16) ((uint16) (M)[0]) << 8)); } while(0)
-#define shortget(V,M)   do { V = (short) (((short) ((uchar) (M)[1]))+\
-                                 ((short) ((short) (M)[0]) << 8)); } while(0)
-#define longget(V,M)    do { int32 def_temp;\
-                             ((uchar*) &def_temp)[0]=(M)[0];\
-                             ((uchar*) &def_temp)[1]=(M)[1];\
-                             ((uchar*) &def_temp)[2]=(M)[2];\
-                             ((uchar*) &def_temp)[3]=(M)[3];\
-                             (V)=def_temp; } while(0)
-#define ulongget(V,M)   do { uint32 def_temp;\
-                            ((uchar*) &def_temp)[0]=(M)[0];\
-                            ((uchar*) &def_temp)[1]=(M)[1];\
-                            ((uchar*) &def_temp)[2]=(M)[2];\
-                            ((uchar*) &def_temp)[3]=(M)[3];\
-                            (V)=def_temp; } while(0)
-#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\
-                             *(((char*)T)+1)=(char)(def_temp); \
-                             *(((char*)T)+0)=(char)(def_temp >> 8); } while(0)
-#define longstore(T,A)  do { *(((char*)T)+3)=((A));\
-                             *(((char*)T)+2)=(((A) >> 8));\
-                             *(((char*)T)+1)=(((A) >> 16));\
-                             *(((char*)T)+0)=(((A) >> 24)); } while(0)
-
-#define floatget(V,M)    memcpy(&V, (M), sizeof(float))
-#define floatstore(T,V)  memcpy((T), (void*) (&V), sizeof(float))
-#define doubleget(V,M)	 memcpy(&V, (M), sizeof(double))
-#define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double))
-#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong))
-#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong))
-
-#else
-
-#define ushortget(V,M)	do { V = uint2korr(M); } while(0)
-#define shortget(V,M)	do { V = sint2korr(M); } while(0)
-#define longget(V,M)	do { V = sint4korr(M); } while(0)
-#define ulongget(V,M)   do { V = uint4korr(M); } while(0)
-#define shortstore(T,V) int2store(T,V)
-#define longstore(T,V)	int4store(T,V)
-#ifndef floatstore
-#define floatstore(T,V)  memcpy((T), (void *) (&V), sizeof(float))
-#define floatget(V,M)    memcpy(&V, (M), sizeof(float))
-#endif
-#ifndef doubleget
-#define doubleget(V,M)	 memcpy(&V, (M), sizeof(double))
-#define doublestore(T,V) memcpy((T), (void *) &V, sizeof(double))
-#endif /* doubleget */
-#define longlongget(V,M) memcpy(&V, (M), sizeof(ulonglong))
-#define longlongstore(T,V) memcpy((T), &V, sizeof(ulonglong))
-
-#endif /* WORDS_BIGENDIAN */
+#include <my_byteorder.h>
 
 #ifdef HAVE_CHARSET_utf8
 #define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8"

=== modified file 'libmysqld/emb_qcache.cc'
--- a/libmysqld/emb_qcache.cc	2011-07-28 08:52:25 +0000
+++ b/libmysqld/emb_qcache.cc	2012-01-11 09:33:52 +0000
@@ -196,7 +196,7 @@ uint Querycache_stream::load_int()
   use_next_block(FALSE);
   memcpy(buf+rest_len, cur_data, 4-rest_len);
   cur_data+= 4-rest_len;
-  result= uint4korr(buf);
+  ulongget(result, buf);
   return result;
 }
 

=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc	2011-12-09 18:59:05 +0000
+++ b/sql/binlog.cc	2012-01-11 09:33:52 +0000
@@ -3994,13 +3994,15 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE 
              LOG_EVENT_HEADER_LEN - carry);
 
       /* fix end_log_pos */
-      val= uint4korr(&header[LOG_POS_OFFSET]) + group +
+      ulongget(val, &header[LOG_POS_OFFSET]);
+      val+= group +
         (end_log_pos_inc+= (do_checksum ? BINLOG_CHECKSUM_LEN : 0));
       int4store(&header[LOG_POS_OFFSET], val);
 
       if (do_checksum)
       {
-        ulong len= uint4korr(&header[EVENT_LEN_OFFSET]);
+        ulong len;
+        ulongget(len, &header[EVENT_LEN_OFFSET]);
         /* fix len */
         int4store(&header[EVENT_LEN_OFFSET], len + BINLOG_CHECKSUM_LEN);
       }
@@ -4017,7 +4019,7 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE 
              LOG_EVENT_HEADER_LEN - carry);
 
       /* next event header at ... */
-      hdr_offs= uint4korr(&header[EVENT_LEN_OFFSET]) - carry -
+      hdr_offs= uint4korr(header + EVENT_LEN_OFFSET) - carry -
         (do_checksum ? BINLOG_CHECKSUM_LEN : 0);
 
       if (do_checksum)

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2011-12-19 22:31:09 +0000
+++ b/sql/ha_partition.cc	2012-01-11 09:33:52 +0000
@@ -2471,7 +2471,7 @@ bool ha_partition::read_par_file(const c
     DBUG_RETURN(TRUE);
   if (mysql_file_read(file, (uchar *) &buff[0], PAR_WORD_SIZE, MYF(MY_NABP)))
     goto err1;
-  len_words= uint4korr(buff);
+  ulongget(len_words, buff);
   len_bytes= PAR_WORD_SIZE * len_words;
   if (mysql_file_seek(file, 0, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR)
     goto err1;

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-12-02 20:46:47 +0000
+++ b/sql/log_event.cc	2012-01-11 09:33:52 +0000
@@ -4036,7 +4036,8 @@ void Query_log_event::print_query_header
       (unlikely(!print_event_info->charset_inited ||
                 memcmp(print_event_info->charset, charset, 6))))
   {
-    CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME));
+    char *charset_p= charset; // Avoid type-punning warning.
+    CHARSET_INFO *cs_info= get_charset(uint2korr(charset_p), MYF(MY_WME));
     if (cs_info)
     {
       /* for mysql client */
@@ -4048,7 +4049,7 @@ void Query_log_event::print_query_header
                 "@@session.collation_connection=%d,"
                 "@@session.collation_server=%d"
                 "%s\n",
-                uint2korr(charset),
+                uint2korr(charset_p),
                 uint2korr(charset+2),
                 uint2korr(charset+4),
                 print_event_info->delimiter);
@@ -4330,9 +4331,10 @@ int Query_log_event::do_apply_event(Rela
       {
         if (rli->cached_charset_compare(charset))
         {
+          char *charset_p= charset; // Avoid type-punning warning.
           /* Verify that we support the charsets found in the event. */
           if (!(thd->variables.character_set_client=
-                get_charset(uint2korr(charset), MYF(MY_WME))) ||
+                get_charset(uint2korr(charset_p), MYF(MY_WME))) ||
               !(thd->variables.collation_connection=
                 get_charset(uint2korr(charset+2), MYF(MY_WME))) ||
               !(thd->variables.collation_server=

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2012-01-04 06:06:07 +0000
+++ b/sql/rpl_slave.cc	2012-01-11 09:33:52 +0000
@@ -5534,7 +5534,7 @@ static int queue_event(Master_info* mi,c
       event_len += BINLOG_CHECKSUM_LEN;
       memcpy(rot_buf, buf, event_len - BINLOG_CHECKSUM_LEN);
       int4store(&rot_buf[EVENT_LEN_OFFSET],
-                uint4korr(&rot_buf[EVENT_LEN_OFFSET]) + BINLOG_CHECKSUM_LEN);
+                uint4korr(rot_buf + EVENT_LEN_OFFSET) + BINLOG_CHECKSUM_LEN);
       rot_crc= my_checksum(rot_crc, (const uchar *) rot_buf,
                            event_len - BINLOG_CHECKSUM_LEN);
       int4store(&rot_buf[event_len - BINLOG_CHECKSUM_LEN], rot_crc);
@@ -5557,7 +5557,7 @@ static int queue_event(Master_info* mi,c
         event_len -= BINLOG_CHECKSUM_LEN;
         memcpy(rot_buf, buf, event_len);
         int4store(&rot_buf[EVENT_LEN_OFFSET],
-                  uint4korr(&rot_buf[EVENT_LEN_OFFSET]) - BINLOG_CHECKSUM_LEN);
+                  uint4korr(rot_buf + EVENT_LEN_OFFSET) - BINLOG_CHECKSUM_LEN);
         DBUG_ASSERT(event_len == uint4korr(&rot_buf[EVENT_LEN_OFFSET]));
         DBUG_ASSERT(mi->rli->relay_log.description_event_for_queue->checksum_alg ==
                     mi->rli->relay_log.relay_log_checksum_alg);

=== modified file 'sql/spatial.cc'
--- a/sql/spatial.cc	2011-07-04 00:25:46 +0000
+++ b/sql/spatial.cc	2012-01-11 09:33:52 +0000
@@ -243,7 +243,9 @@ static uint32 wkb_get_uint(const char *p
     inv_array[1]= ptr[2];
     inv_array[2]= ptr[1];
     inv_array[3]= ptr[0];
-    return uint4korr(inv_array);
+    uint32 ret;
+    ulongget(ret, inv_array);
+    return ret;
   }
 }
 

=== modified file 'sql/sql_join_buffer.h'
--- a/sql/sql_join_buffer.h	2011-12-15 09:00:42 +0000
+++ b/sql/sql_join_buffer.h	2012-01-11 09:33:52 +0000
@@ -323,8 +323,7 @@ protected:
   /* Shall calculate how much space is remaining in the join buffer */ 
   virtual ulong rem_space() 
   { 
-    using std::max;
-    return max(buff_size-(end_pos-buff)-aux_buff_size, 0UL);
+    return std::max<ulong>(buff_size-(end_pos-buff)-aux_buff_size, 0UL);
   }
 
   /* Shall skip record from the join buffer if its match flag is on */
@@ -808,8 +807,7 @@ protected:
   */ 
   ulong rem_space() 
   { 
-    using std::max;
-    return max(last_key_entry-end_pos-aux_buff_size, 0UL);
+    return std::max<ulong>(last_key_entry-end_pos-aux_buff_size, 0UL);
   }
 
   /* 

=== modified file 'sql/unireg.cc'
--- a/sql/unireg.cc	2011-08-29 12:08:58 +0000
+++ b/sql/unireg.cc	2012-01-11 09:33:52 +0000
@@ -297,7 +297,9 @@ bool mysql_create_frm(THD *thd, const ch
 
   if (!(filepos= make_new_entry(file, fileinfo, NULL, "")))
     goto err;
-  maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000));
+  ushort io_sz;
+  ushortget(io_sz, forminfo);
+  maxlength=(uint) next_io_size((ulong) (io_sz + 1000));
   int2store(forminfo+2,maxlength);
   int4store(fileinfo+10,(ulong) (filepos+maxlength));
   fileinfo[26]= (uchar) test((create_info->max_rows == 1) &&

=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc	2011-11-29 13:18:47 +0000
+++ b/storage/archive/ha_archive.cc	2012-01-11 09:33:52 +0000
@@ -1277,7 +1277,7 @@ int ha_archive::unpack_row(azio_stream *
   if (read == 0 || read != ARCHIVE_ROW_HEADER_SIZE)
     DBUG_RETURN(HA_ERR_END_OF_FILE);
 
-  row_len=  uint4korr(size_buffer);
+  ulongget(row_len, size_buffer);
   DBUG_PRINT("ha_archive",("Unpack row length %u -> %u", row_len, 
                            (unsigned int)table->s->reclength));
 

=== modified file 'unittest/gunit/CMakeLists.txt'
--- a/unittest/gunit/CMakeLists.txt	2011-12-02 13:33:08 +0000
+++ b/unittest/gunit/CMakeLists.txt	2012-01-11 09:33:52 +0000
@@ -225,8 +225,10 @@ ENDIF()
 
 # Add tests (link them with gunit library) 
 SET(TESTS
+  alignment
   bounded_queue
   bounds_checked_array
+  byteorder
   dbug
   decimal
   dynarray

=== added file 'unittest/gunit/alignment-t.cc'
--- a/unittest/gunit/alignment-t.cc	1970-01-01 00:00:00 +0000
+++ b/unittest/gunit/alignment-t.cc	2012-01-11 09:33:52 +0000
@@ -0,0 +1,146 @@
+// First include (the generated) my_config.h, to get correct platform defines.
+#include "my_config.h"
+#include <gtest/gtest.h>
+
+#include "my_global.h"
+
+#include <algorithm>
+#include <vector>
+
+namespace {
+
+/*
+  Testing performance penalty of accessing un-aligned data.
+  Seems to about 2% on my desktop machine.
+ */
+class AlignmentTest : public ::testing::Test
+{
+protected:
+  // Increase num_iterations for actual benchmarking!
+  static const int num_iterations= 1;
+  static const int num_records= 100 * 1000;
+
+  static int* aligned_data;
+  static uchar* unaligned_data;
+
+  static void SetUpTestCase()
+  {
+    aligned_data= new int[num_records];
+    unaligned_data= new uchar[(num_records + 1) * sizeof(int)];
+    for (int ix= 0; ix < num_records; ++ix)
+    {
+      aligned_data[ix]= ix / 10;
+    }
+    std::random_shuffle(aligned_data, aligned_data + num_records);
+    memcpy(unaligned_data + 1, aligned_data, num_records * sizeof(int));
+  }
+
+  static void TearDownTestCase()
+  {
+    delete[] aligned_data;
+    delete[] unaligned_data;
+  }
+
+  virtual void SetUp()
+  {
+    aligned_keys= new uchar* [num_records];
+    unaligned_keys= new uchar* [num_records];
+    for (int ix= 0; ix < num_records; ++ix)
+    {
+      aligned_keys[ix]=
+        static_cast<uchar*>(static_cast<void*>(&aligned_data[ix]));
+      unaligned_keys[ix]=
+        &unaligned_data[1 + (ix * sizeof(int))];
+    }
+  }
+
+  virtual void TearDown()
+  {
+    delete[] aligned_keys;
+    delete[] unaligned_keys;
+  }
+
+  uchar **aligned_keys;
+  uchar **unaligned_keys;
+};
+
+int* AlignmentTest::aligned_data;
+uchar* AlignmentTest::unaligned_data;
+
+// A copy of the generic, byte-by-byte getter.
+#define sint4korrgeneric(A) (int32) (((int32) ((uchar) (A)[0])) +\
+                                     (((int32) ((uchar) (A)[1]) << 8)) + \
+                                     (((int32) ((uchar) (A)[2]) << 16)) + \
+                                     (((int32) ((int16) (A)[3]) << 24)))
+class Mem_compare_uchar_int :
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  bool operator() (const uchar *s1, const uchar *s2)
+  {
+    return *(int*) s1 < *(int*) s2;
+  }
+};
+
+class Mem_compare_sint4 :
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  bool operator() (const uchar *s1, const uchar *s2)
+  {
+    return sint4korr(s1) < sint4korr(s2);
+  }
+};
+
+class Mem_compare_sint4_generic :
+  public std::binary_function<const uchar*, const uchar*, bool>
+{
+public:
+  bool operator() (const uchar *s1, const uchar *s2)
+  {
+    return sint4korrgeneric(s1) < sint4korrgeneric(s2);
+  }
+};
+
+#if defined(__i386__) || defined(__x86_64__)
+
+
+TEST_F(AlignmentTest, AlignedSort)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(aligned_keys, aligned_keys + num_records);
+    std::sort(keys.begin(), keys.end(), Mem_compare_uchar_int());
+  }
+}
+
+TEST_F(AlignmentTest, UnAlignedSort)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(unaligned_keys, unaligned_keys + num_records);
+    std::sort(keys.begin(), keys.end(), Mem_compare_uchar_int());
+  }
+}
+
+TEST_F(AlignmentTest, Sint4Sort)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(unaligned_keys, unaligned_keys + num_records);
+    std::sort(keys.begin(), keys.end(), Mem_compare_sint4());
+  }
+}
+
+TEST_F(AlignmentTest, Sint4SortGeneric)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+  {
+    std::vector<uchar*> keys(unaligned_keys, unaligned_keys + num_records);
+    std::sort(keys.begin(), keys.end(), Mem_compare_sint4_generic());
+  }
+}
+
+#endif
+
+}

=== added file 'unittest/gunit/byteorder-t.cc'
--- a/unittest/gunit/byteorder-t.cc	1970-01-01 00:00:00 +0000
+++ b/unittest/gunit/byteorder-t.cc	2012-01-11 09:33:52 +0000
@@ -0,0 +1,246 @@
+/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA */
+
+#include "my_config.h"
+#include <gtest/gtest.h>
+#include <limits>
+
+#include "my_global.h"
+
+namespace {
+
+using std::numeric_limits;
+
+#if defined(GTEST_HAS_PARAM_TEST)
+
+/*
+  This class is used to instantiate parameterized tests for float and double.
+ */
+template<typename T>
+class FloatingTest
+{
+protected:
+  T input;
+  T output;
+  uchar buf[sizeof(T)];
+};
+
+class Float4Test : public FloatingTest<float>,
+                   public ::testing::TestWithParam<float>
+{
+  virtual void SetUp()
+  {
+    input= GetParam();
+    output= numeric_limits<float>::quiet_NaN();
+  }
+};
+
+INSTANTIATE_TEST_CASE_P(Foo, Float4Test,
+                        ::testing::Values(numeric_limits<float>::min(),
+                                          numeric_limits<float>::max(),
+                                          numeric_limits<float>::epsilon(),
+                                          -numeric_limits<float>::min(),
+                                          -numeric_limits<float>::max(),
+                                          -numeric_limits<float>::epsilon(),
+                                          -1.0f, 0.0f, 1.0f));
+/*
+  The actual test case for float: store and get some values.
+ */
+TEST_P(Float4Test, PutAndGet)
+{
+  float4store(buf, input);
+  float4get(output, buf);
+  EXPECT_EQ(input, output);
+  floatstore(buf, input);
+  floatget(output, buf);
+  EXPECT_EQ(input, output);
+}
+
+
+class Float8Test : public FloatingTest<double>,
+                   public ::testing::TestWithParam<double>
+{
+  virtual void SetUp()
+  {
+    input= GetParam();
+    output= numeric_limits<double>::quiet_NaN();
+  }
+};
+
+INSTANTIATE_TEST_CASE_P(Foo, Float8Test,
+                        ::testing::Values(numeric_limits<double>::min(),
+                                          numeric_limits<double>::max(),
+                                          numeric_limits<double>::epsilon(),
+                                          -numeric_limits<double>::min(),
+                                          -numeric_limits<double>::max(),
+                                          -numeric_limits<double>::epsilon(),
+                                          -1.0, 0.0, 1.0));
+/*
+  The actual test case for double: store and get some values.
+ */
+TEST_P(Float8Test, PutAndGet)
+{
+  float8store(buf, input);
+  float8get(output, buf);
+  EXPECT_EQ(input, output);
+  doublestore(buf, input);
+  doubleget(output, buf);
+  EXPECT_EQ(input, output);
+}
+
+#endif  // GTEST_HAS_PARAM_TEST
+
+
+#if defined(GTEST_HAS_TYPED_TEST)
+
+/*
+  A test fixture class, parameterized on type.
+  Will be instantiated for all IntegralTypes below.
+ */
+template<typename T>
+class IntegralTest : public ::testing::Test
+{
+protected:
+  typedef std::numeric_limits<T> Limit;
+
+  T input;
+  T output;
+  uchar buf[sizeof(T)];
+
+  typename std::vector<T> values;
+
+  IntegralTest() : input(0), output(0) {}
+
+  virtual void SetUp()
+  {
+    values.push_back(Limit::min());
+    values.push_back(Limit::min() / T(2));
+    values.push_back(T(0));
+    values.push_back(T(42));
+    values.push_back(Limit::max() / T(2));
+    values.push_back(Limit::max());
+  }
+};
+
+/*
+  A class to make our 3, 5 and 6 digit integers look like builtins.
+ */
+template<int ndigits>
+struct sizeNint
+{
+  // For numeric_limits.
+  typedef ulonglong value_type;
+
+  sizeNint() : value(0) {}
+  explicit sizeNint(ulonglong v)
+  {
+    switch(ndigits)
+    {
+    case 3: value= v & 0xFFFFFFULL;       break;
+    case 5: value= v & 0xFFFFFFFFFFULL;   break;
+    case 6: value= v & 0xFFFFFFFFFFFFULL; break;
+    default: ADD_FAILURE() << "unxpected number of digits";
+    }
+  }
+
+  sizeNint operator/(const sizeNint &that) const
+  { return sizeNint(this->value / that.value); }
+
+  bool operator==(const sizeNint &that) const
+  { return this->value == that.value; }
+
+  ulonglong value;
+};
+
+// googletest needs to be able to print arguments to EXPECT_EQ.
+template<int ndigits>
+std::ostream &operator<<(std::ostream &s, const sizeNint<ndigits> &v)
+{ return s << v.value; }
+
+// Instantiate the PutAndGet test for all these types:
+typedef ::testing::Types<short, ushort,
+                         sizeNint<3>, sizeNint<5>, sizeNint<6>,
+                         int, unsigned,
+                         longlong, ulonglong> IntegralTypes;
+
+TYPED_TEST_CASE(IntegralTest, IntegralTypes);
+
+/*
+  Wrap all the __get, __store, __korr macros in functions.
+ */
+template<typename T> void put_integral(uchar *buf, T val)
+{ ADD_FAILURE() << "unknown type in put_integral"; }
+template<typename T> void get_integral(T &val, uchar *buf)
+{ ADD_FAILURE() << "unknown type in get_integral"; }
+
+template<> void put_integral(uchar *buf, short val)  { shortstore(buf, val); }
+template<> void get_integral(short &val, uchar *buf) { shortget(val, buf); }
+
+// Hmm, there's no ushortstore...
+template<> void put_integral(uchar *buf, ushort val)  { shortstore(buf, val); }
+template<> void get_integral(ushort &val, uchar *buf) { ushortget(val, buf); }
+
+template<> void put_integral(uchar *buf, int val)  { longstore(buf, val); }
+template<> void get_integral(int &val, uchar *buf) { longget(val, buf); }
+
+// Hmm, there's no ulongstore...
+template<> void put_integral(uchar *buf, unsigned val)  { longstore(buf, val); }
+template<> void get_integral(unsigned &val, uchar *buf) { ulongget(val, buf); }
+
+template<> void put_integral(uchar *buf, longlong val)
+{ longlongstore(buf, val); }
+template<> void get_integral(longlong &val, uchar *buf)
+{ longlongget(val, buf); }
+
+// Reading ulonglong is different from all the above ....
+template<> void put_integral(uchar *buf, ulonglong val)
+{ int8store(buf, val); }
+template<> void get_integral(ulonglong &val, uchar *buf)
+{ val= uint8korr(buf); }
+
+template<> void put_integral(uchar *buf, sizeNint<3> val)
+{ int3store(buf, val.value); }
+template<> void get_integral(sizeNint<3> &val, uchar *buf)
+{ val.value= uint3korr(buf); }
+
+template<> void put_integral(uchar *buf, sizeNint<5> val)
+{ int5store(buf, val.value); }
+template<> void get_integral(sizeNint<5> &val, uchar *buf)
+{ val.value= uint5korr(buf); }
+
+template<> void put_integral(uchar *buf, sizeNint<6> val)
+{ int6store(buf, val.value); }
+template<> void get_integral(sizeNint<6> &val, uchar *buf)
+{ val.value= uint6korr(buf); }
+
+/*
+  This is the actual test which will be instantiated for all IntegralTypes.
+ */
+TYPED_TEST(IntegralTest, PutAndGet)
+{
+  for (size_t ix= 0; ix < this->values.size(); ++ix)
+  {
+    this->input= this->values[ix];
+    put_integral(this->buf, this->input);
+    get_integral(this->output, this->buf);
+    // Visual studio rejects: EXPECT_EQ(this->input, this->output);
+    TypeParam myinput= this->input;
+    TypeParam myoutput= this->output;
+    EXPECT_EQ(myinput, myoutput);
+  }
+}
+
+#endif  // GTEST_HAS_TYPED_TEST
+}

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (tor.didriksen:3718 to 3720) Tor Didriksen11 Jan