Move SPIR-V constants/limits to a separate header.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b7dd5cb..d2821b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,6 +113,7 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/source/opcode.h
   ${CMAKE_CURRENT_SOURCE_DIR}/source/operand.h
   ${CMAKE_CURRENT_SOURCE_DIR}/source/print.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/source/spirv_constant.h
   ${CMAKE_CURRENT_SOURCE_DIR}/source/table.h
   ${CMAKE_CURRENT_SOURCE_DIR}/source/text.h
   ${CMAKE_CURRENT_SOURCE_DIR}/source/text_handler.h
diff --git a/include/libspirv/libspirv.h b/include/libspirv/libspirv.h
index 0244624..f288320 100644
--- a/include/libspirv/libspirv.h
+++ b/include/libspirv/libspirv.h
@@ -40,44 +40,6 @@
 #include <stddef.h>
 #include <stdint.h>
 
-// Header indices
-
-#define SPV_INDEX_MAGIC_NUMBER 0u
-#define SPV_INDEX_VERSION_NUMBER 1u
-#define SPV_INDEX_GENERATOR_NUMBER 2u
-#define SPV_INDEX_BOUND 3u
-#define SPV_INDEX_SCHEMA 4u
-#define SPV_INDEX_INSTRUCTION 5u
-
-// Universal limits
-
-// SPIR-V 1.0 limits
-#define SPV_LIMIT_INSTRUCTION_WORD_COUNT_MAX 0xffff
-#define SPV_LIMIT_LITERAL_STRING_UTF8_CHARS_MAX 0xffff
-
-// A single Unicode character in UTF-8 encoding can take
-// up 4 bytes.
-#define SPV_LIMIT_LITERAL_STRING_BYTES_MAX \
-  (SPV_LIMIT_LITERAL_STRING_UTF8_CHARS_MAX * 4)
-
-// NOTE: These are set to the minimum maximum values
-// TODO(dneto): Check these.
-
-// libspirv limits.
-#define SPV_LIMIT_RESULT_ID_BOUND 0x00400000
-#define SPV_LIMIT_CONTROL_FLOW_NEST_DEPTH 0x00000400
-#define SPV_LIMIT_GLOBAL_VARIABLES_MAX 0x00010000
-#define SPV_LIMIT_LOCAL_VARIABLES_MAX 0x00080000
-// TODO: Decorations per target ID max, depends on decoration table size
-#define SPV_LIMIT_EXECUTION_MODE_PER_ENTRY_POINT_MAX 0x00000100
-#define SPV_LIMIT_INDICIES_MAX_ACCESS_CHAIN_COMPOSITE_MAX 0x00000100
-#define SPV_LIMIT_FUNCTION_PARAMETERS_PER_FUNCTION_DECL 0x00000100
-#define SPV_LIMIT_FUNCTION_CALL_ARGUMENTS_MAX 0x00000100
-#define SPV_LIMIT_EXT_FUNCTION_CALL_ARGUMENTS_MAX 0x00000100
-#define SPV_LIMIT_SWITCH_LITERAL_LABEL_PAIRS_MAX 0x00004000
-#define SPV_LIMIT_STRUCT_MEMBERS_MAX 0x0000400
-#define SPV_LIMIT_STRUCT_NESTING_DEPTH_MAX 0x00000100
-
 // Helpers
 
 #define spvIsInBitfield(value, bitfield) (value == (value & bitfield))
@@ -87,8 +49,6 @@
 #define SPV_FORCE_16_BIT_ENUM(name) _##name = 0x7fff
 #define SPV_FORCE_32_BIT_ENUM(name) _##name = 0x7fffffff
 
-#define SPV_OPERAND_INVALID_RESULT_ID_INDEX -1
-
 // A bit mask representing a set of capabilities.
 // Currently there are 54 distinct capabilities, so 64 bits
 // should be enough.
@@ -103,18 +63,6 @@
 
 // Enumerations
 
-// Values mapping to registered vendors.  See the registry at
-// https://www.khronos.org/registry/spir-v/api/spir-v.xml
-typedef enum spv_generator_t {
-  SPV_GENERATOR_KHRONOS = 0,
-  SPV_GENERATOR_LUNARG = 1,
-  SPV_GENERATOR_VALVE = 2,
-  SPV_GENERATOR_CODEPLAY = 3,
-  SPV_GENERATOR_NVIDIA = 4,
-  SPV_GENERATOR_ARM = 5,
-  SPV_FORCE_32_BIT_ENUM(spv_generator_t)
-} spv_generator_t;
-
 typedef enum spv_result_t {
   SPV_SUCCESS = 0,
   SPV_UNSUPPORTED = 1,
diff --git a/source/binary.cpp b/source/binary.cpp
index fb62a85..062eadd 100644
--- a/source/binary.cpp
+++ b/source/binary.cpp
@@ -38,6 +38,7 @@
 #include "libspirv/libspirv.h"
 #include "opcode.h"
 #include "operand.h"
+#include "spirv_constant.h"
 
 spv_result_t spvBinaryHeaderGet(const spv_const_binary binary,
                                 const spv_endianness_t endian,
diff --git a/source/opcode.cpp b/source/opcode.cpp
index f7e3259..b9ad377 100644
--- a/source/opcode.cpp
+++ b/source/opcode.cpp
@@ -32,6 +32,7 @@
 #include "endian.h"
 #include "instruction.h"
 #include "libspirv/libspirv.h"
+#include "spirv_constant.h"
 
 namespace {
 
@@ -372,13 +373,6 @@
   return SPV_ERROR_INVALID_LOOKUP;
 }
 
-int16_t spvOpcodeResultIdIndex(spv_opcode_desc entry) {
-  for (int16_t i = 0; i < entry->numTypes; ++i) {
-    if (SPV_OPERAND_TYPE_RESULT_ID == entry->operandTypes[i]) return i;
-  }
-  return SPV_OPERAND_INVALID_RESULT_ID_INDEX;
-}
-
 int32_t spvOpcodeRequiresCapabilities(spv_opcode_desc entry) {
   return entry->capabilities != 0;
 }
diff --git a/source/spirv_constant.h b/source/spirv_constant.h
new file mode 100644
index 0000000..64ece27
--- /dev/null
+++ b/source/spirv_constant.h
@@ -0,0 +1,84 @@
+// Copyright (c) 2015 The Khronos Group Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and/or associated documentation files (the
+// "Materials"), to deal in the Materials without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Materials, and to
+// permit persons to whom the Materials are furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Materials.
+//
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+//    https://www.khronos.org/registry/
+//
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+#ifndef LIBSPIRV_SPIRV_CONSTANT_H_
+#define LIBSPIRV_SPIRV_CONSTANT_H_
+
+#include "libspirv/libspirv.h"
+
+// Header indices
+
+#define SPV_INDEX_MAGIC_NUMBER 0u
+#define SPV_INDEX_VERSION_NUMBER 1u
+#define SPV_INDEX_GENERATOR_NUMBER 2u
+#define SPV_INDEX_BOUND 3u
+#define SPV_INDEX_SCHEMA 4u
+#define SPV_INDEX_INSTRUCTION 5u
+
+// Universal limits
+
+// SPIR-V 1.0 limits
+#define SPV_LIMIT_INSTRUCTION_WORD_COUNT_MAX 0xffff
+#define SPV_LIMIT_LITERAL_STRING_UTF8_CHARS_MAX 0xffff
+
+// A single Unicode character in UTF-8 encoding can take
+// up 4 bytes.
+#define SPV_LIMIT_LITERAL_STRING_BYTES_MAX \
+  (SPV_LIMIT_LITERAL_STRING_UTF8_CHARS_MAX * 4)
+
+// NOTE: These are set to the minimum maximum values
+// TODO(dneto): Check these.
+
+// libspirv limits.
+#define SPV_LIMIT_RESULT_ID_BOUND 0x00400000
+#define SPV_LIMIT_CONTROL_FLOW_NEST_DEPTH 0x00000400
+#define SPV_LIMIT_GLOBAL_VARIABLES_MAX 0x00010000
+#define SPV_LIMIT_LOCAL_VARIABLES_MAX 0x00080000
+// TODO: Decorations per target ID max, depends on decoration table size
+#define SPV_LIMIT_EXECUTION_MODE_PER_ENTRY_POINT_MAX 0x00000100
+#define SPV_LIMIT_INDICIES_MAX_ACCESS_CHAIN_COMPOSITE_MAX 0x00000100
+#define SPV_LIMIT_FUNCTION_PARAMETERS_PER_FUNCTION_DECL 0x00000100
+#define SPV_LIMIT_FUNCTION_CALL_ARGUMENTS_MAX 0x00000100
+#define SPV_LIMIT_EXT_FUNCTION_CALL_ARGUMENTS_MAX 0x00000100
+#define SPV_LIMIT_SWITCH_LITERAL_LABEL_PAIRS_MAX 0x00004000
+#define SPV_LIMIT_STRUCT_MEMBERS_MAX 0x0000400
+#define SPV_LIMIT_STRUCT_NESTING_DEPTH_MAX 0x00000100
+
+// Enumerations
+
+// Values mapping to registered vendors.  See the registry at
+// https://www.khronos.org/registry/spir-v/api/spir-v.xml
+typedef enum spv_generator_t {
+  SPV_GENERATOR_KHRONOS = 0,
+  SPV_GENERATOR_LUNARG = 1,
+  SPV_GENERATOR_VALVE = 2,
+  SPV_GENERATOR_CODEPLAY = 3,
+  SPV_GENERATOR_NVIDIA = 4,
+  SPV_GENERATOR_ARM = 5,
+  SPV_FORCE_32_BIT_ENUM(spv_generator_t)
+} spv_generator_t;
+
+#endif  // LIBSPIRV_SPIRV_CONSTANT_H_
diff --git a/source/text.cpp b/source/text.cpp
index b440552..aa870c7 100644
--- a/source/text.cpp
+++ b/source/text.cpp
@@ -46,6 +46,7 @@
 #include "libspirv/libspirv.h"
 #include "opcode.h"
 #include "operand.h"
+#include "spirv_constant.h"
 #include "table.h"
 #include "text_handler.h"
 #include "util/bitutils.h"
diff --git a/source/text.h b/source/text.h
index 5c5dc56..2bd9fb3 100644
--- a/source/text.h
+++ b/source/text.h
@@ -31,6 +31,7 @@
 
 #include "libspirv/libspirv.h"
 #include "operand.h"
+#include "spirv_constant.h"
 
 // Structures
 
diff --git a/source/validate.cpp b/source/validate.cpp
index 5959a6e..65ee86f 100644
--- a/source/validate.cpp
+++ b/source/validate.cpp
@@ -39,6 +39,7 @@
 #include "libspirv/libspirv.h"
 #include "opcode.h"
 #include "operand.h"
+#include "spirv_constant.h"
 
 #define spvCheckReturn(expression) \
   if (spv_result_t error = (expression)) return error;
diff --git a/test/BinaryHeaderGet.cpp b/test/BinaryHeaderGet.cpp
index 853912b..a856ed1 100644
--- a/test/BinaryHeaderGet.cpp
+++ b/test/BinaryHeaderGet.cpp
@@ -25,6 +25,7 @@
 // MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
 
 #include "UnitSPIRV.h"
+#include "../source/spirv_constant.h"
 
 namespace {
 
diff --git a/test/BinaryToText.cpp b/test/BinaryToText.cpp
index 9921448..f8096c4 100644
--- a/test/BinaryToText.cpp
+++ b/test/BinaryToText.cpp
@@ -28,9 +28,11 @@
 
 #include <sstream>
 
-#include "TestFixture.h"
 #include "gmock/gmock.h"
 
+#include "TestFixture.h"
+#include "../source/spirv_constant.h"
+
 using ::testing::Eq;
 using spvtest::AutoText;
 
diff --git a/test/TextToBinary.cpp b/test/TextToBinary.cpp
index 2602a93..5a73619 100644
--- a/test/TextToBinary.cpp
+++ b/test/TextToBinary.cpp
@@ -28,10 +28,12 @@
 #include <utility>
 #include <vector>
 
-#include "TestFixture.h"
 #include "gmock/gmock.h"
+
+#include "TestFixture.h"
 #include "UnitSPIRV.h"
 #include "util/bitutils.h"
+#include "../source/spirv_constant.h"
 
 namespace {