diff --git a/chapter1.md b/chapter1.md index 40796db..b96b1e0 100644 --- a/chapter1.md +++ b/chapter1.md @@ -431,7 +431,7 @@ impl BytePacketBuffer { // If len has the two most significant bit are set, it represents a jump to // some other offset in the packet: - if (len & 0xC0) > 0 { + if (len & 0xC0) == 0xC0 { // Update the buffer position to a point past the current // label. We don't need to touch it any further. if !jumped { diff --git a/samples/sample1.rs b/samples/sample1.rs index e2943f1..ea982ad 100644 --- a/samples/sample1.rs +++ b/samples/sample1.rs @@ -87,7 +87,7 @@ impl BytePacketBuffer { // set, represents a offset relative to the start of the buffer. We // handle this by jumping to the offset, setting a flag to indicate // that we shouldn't update the shared buffer position once done. - if (len & 0xC0) > 0 { + if (len & 0xC0) == 0xC0 { // When a jump is performed, we only modify the shared buffer // position once, and avoid making the change later on. diff --git a/samples/sample2.rs b/samples/sample2.rs index 98442eb..d9afc50 100644 --- a/samples/sample2.rs +++ b/samples/sample2.rs @@ -87,7 +87,7 @@ impl BytePacketBuffer { // set, represents a offset relative to the start of the buffer. We // handle this by jumping to the offset, setting a flag to indicate // that we shouldn't update the shared buffer position once done. - if (len & 0xC0) > 0 { + if (len & 0xC0) == 0xC0 { // When a jump is performed, we only modify the shared buffer // position once, and avoid making the change later on. diff --git a/samples/sample3.rs b/samples/sample3.rs index 9bff2b1..d012fda 100644 --- a/samples/sample3.rs +++ b/samples/sample3.rs @@ -87,7 +87,7 @@ impl BytePacketBuffer { // set, represents a offset relative to the start of the buffer. We // handle this by jumping to the offset, setting a flag to indicate // that we shouldn't update the shared buffer position once done. - if (len & 0xC0) > 0 { + if (len & 0xC0) == 0xC0 { // When a jump is performed, we only modify the shared buffer // position once, and avoid making the change later on. diff --git a/samples/sample4.rs b/samples/sample4.rs index 900f736..d609c52 100644 --- a/samples/sample4.rs +++ b/samples/sample4.rs @@ -87,7 +87,7 @@ impl BytePacketBuffer { // set, represents a offset relative to the start of the buffer. We // handle this by jumping to the offset, setting a flag to indicate // that we shouldn't update the shared buffer position once done. - if (len & 0xC0) > 0 { + if (len & 0xC0) == 0xC0 { // When a jump is performed, we only modify the shared buffer // position once, and avoid making the change later on. diff --git a/samples/sample5.rs b/samples/sample5.rs index 94a254b..a53f0f1 100644 --- a/samples/sample5.rs +++ b/samples/sample5.rs @@ -87,7 +87,7 @@ impl BytePacketBuffer { // set, represents a offset relative to the start of the buffer. We // handle this by jumping to the offset, setting a flag to indicate // that we shouldn't update the shared buffer position once done. - if (len & 0xC0) > 0 { + if (len & 0xC0) == 0xC0 { // When a jump is performed, we only modify the shared buffer // position once, and avoid making the change later on.