+/* The value to which buffer sizes should be limited. Microsoft's
+ * implementation seems to use 67108864 (2^26) bytes. However, since the format
+ * itself supports higher match lengths and offsets, we'll use 2^30 bytes. */
+#define LZMS_MAX_BUFFER_SIZE 1073741824
+
+/* The length of each LRU queue for match sources:
+ *
+ * 1. offsets of LZ matches
+ * 2. (power, raw offset) pairs of delta matches */
+#define LZMS_NUM_LZ_REPS 3
+#define LZMS_NUM_DELTA_REPS 3
+
+/* The numbers of binary decision classes needed for encoding queue indices */
+#define LZMS_NUM_LZ_REP_DECISIONS (LZMS_NUM_LZ_REPS - 1)
+#define LZMS_NUM_DELTA_REP_DECISIONS (LZMS_NUM_DELTA_REPS - 1)
+
+/* These are the numbers of probability entries for each binary decision class.
+ * The logarithm base 2 of each of these values is the number of recently
+ * encoded bits that are remembered for each decision class and are used to
+ * select the appropriate probability entry when decoding/encoding the next
+ * binary decision (bit). */
+#define LZMS_NUM_MAIN_PROBS 16
+#define LZMS_NUM_MATCH_PROBS 32
+#define LZMS_NUM_LZ_PROBS 64
+#define LZMS_NUM_LZ_REP_PROBS 64
+#define LZMS_NUM_DELTA_PROBS 64
+#define LZMS_NUM_DELTA_REP_PROBS 64
+
+/* These values define the precision for probabilities in LZMS, which are always
+ * given as a numerator; the denominator is implied. */