Merge pull request #22212 from XenoAmess

* gh-22212:
  Polish "Remove redundant bitwise operations"
  Remove redundant bitwise operations

Closes gh-22212
pull/22256/head
Andy Wilkinson 4 years ago
commit 0200a3783b

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -72,12 +72,12 @@ class Frame {
void write(OutputStream outputStream) throws IOException { void write(OutputStream outputStream) throws IOException {
outputStream.write(0x80 | this.type.code); outputStream.write(0x80 | this.type.code);
if (this.payload.length < 126) { if (this.payload.length < 126) {
outputStream.write(0x00 | (this.payload.length & 0x7F)); outputStream.write(this.payload.length & 0x7F);
} }
else { else {
outputStream.write(0x7E); outputStream.write(0x7E);
outputStream.write(this.payload.length >> 8 & 0xFF); outputStream.write(this.payload.length >> 8 & 0xFF);
outputStream.write(this.payload.length >> 0 & 0xFF); outputStream.write(this.payload.length & 0xFF);
} }
outputStream.write(this.payload); outputStream.write(this.payload);
outputStream.flush(); outputStream.flush();

Loading…
Cancel
Save