diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ba559d82bc064769a7ea6770396e7e12debe961..ecb3f1b43864edd4e81b7916ac808837cfa1d1b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,11 @@ project(tarantool)
 include(CheckLibraryExists)
 include(CheckIncludeFile)
 include(CheckCCompilerFlag)
+<<<<<<< HEAD
 include(CheckSymbolExists)
+=======
+include(TestBigEndian)
+>>>>>>> master-stable
 find_program(ECHO echo)
 find_program(CAT cat)
 find_program(GIT git)
@@ -51,6 +55,24 @@ endif()
 check_symbol_exists(MAP_ANON sys/mman.h HAVE_MAP_ANON)
 check_symbol_exists(MAP_ANONYMOUS sys/mman.h HAVE_MAP_ANONYMOUS)
 
+test_big_endian(HAVE_BYTE_ORDER_BIG_ENDIAN)
+
+#
+# We do not perform host-to-network byte order translation,
+# and simply assume the machine is little-endian.
+# We also do not bother with trying to avoid unaligned
+# word access. Refuse to compile on rare hardware such as
+# Sparc or Itanium.
+#
+if (${HAVE_BYTE_ORDER_BIG_ENDIAN} OR
+    ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "sparc" OR
+    ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ia64" OR
+    ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^alpha")
+    message (FATAL_ERROR "Unsupported architecture -- ${CMAKE_SYSTEM_PROCESSOR}, ")
+    message (FATAL_ERROR "Tarantool currently only supports little-endian hardware")
+    message (FATAL_ERROR "with unaligned word access.")
+endif()
+
 #
 # Some versions of GNU libc define non-portable __libc_stack_end
 # which we use to determine the end (or beginning, actually) of
diff --git a/connector/c/client.c b/connector/c/client.c
index 5b39911e5d52d67cc9120d9cdac214aac80684b8..d117e3d5e3c3a915bd238961bfdd669c63dcd104 100644
--- a/connector/c/client.c
+++ b/connector/c/client.c
@@ -123,15 +123,9 @@ int tnt_execute_raw(struct tnt_connection *tnt, const char *message,
 	if (tnt_res) {
 		memset(tnt_res, 0, sizeof *tnt_res);
 
-		int ret_code = buf[12];
-		int b = 256;
-		int i = 13;
-		while (i < 16) {
-			ret_code += (buf[i++] * b);
-			b *= 256;
-		}
-
-		tnt_res->errcode = ret_code; /* see iproto.h */
+		/* @fixme: we may want to support big-endian some
+		 * day. */
+		tnt_res->errcode = * (uint32_t*) (buf+12); /* see iproto.h */
 	}
 	return 0;
 }
diff --git a/include/config.h.cmake b/include/config.h.cmake
index 456ba69ebb9c968ac693c418e0931a0478bac544..3afeff0a73afb1e88ab43b13f919e85d0fa244e3 100644
--- a/include/config.h.cmake
+++ b/include/config.h.cmake
@@ -46,6 +46,10 @@
  * Set if this is a GNU system and libc has __libc_stack_end.
  */
 #cmakedefine HAVE_LIBC_STACK_END 1
+/*
+ * Defined if this is a big-endian system.
+ */
+#cmakedefine HAVE_BYTE_ORDER_BIG_ENDIAN 1
 /*
  * vim: syntax=c
  */