瀏覽代碼

Add more commentary to minNonLiteralBlockSize.

Nigel Tao 9 年之前
父節點
當前提交
cef980a12b
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      encode.go

+ 3 - 0
encode.go

@@ -160,6 +160,9 @@ const inputMargin = 16 - 1
 //
 // The C++ code doesn't use this exact threshold, but it could, as discussed at
 // https://groups.google.com/d/topic/snappy-compression/oGbhsdIJSJ8/discussion
+// The difference between Go (2+inputMargin) and C++ (inputMargin) is purely an
+// optimization. It should not affect the encoded form. This is tested by
+// TestSameEncodingAsCppShortCopies.
 const minNonLiteralBlockSize = 1 + 1 + inputMargin
 
 func hash(u, shift uint32) uint32 {