MCPcopy Index your code
hub / github.com/PokemonGoF/PokemonGo-Bot / calcLengthLength

Function calcLengthLength

map-chat/javascript/browserMqtt.js:1901–1913  ·  view source on GitHub ↗

* calcLengthLength - calculate the length of the remaining * length field * * @api private

(length)

Source from the content-addressed store, hash-verified

1899 * @api private
1900 */
1901function calcLengthLength(length) {
1902 if (length >= 0 && length < 128) {
1903 return 1
1904 } else if (length >= 128 && length < 16384) {
1905 return 2
1906 } else if (length >= 16384 && length < 2097152) {
1907 return 3
1908 } else if (length >= 2097152 && length < 268435456) {
1909 return 4
1910 } else {
1911 return 0
1912 }
1913}
1914
1915/**
1916 * writeLength - write an MQTT style length field to the buffer

Callers 5

connectFunction · 0.85
publishFunction · 0.85
subscribeFunction · 0.85
subackFunction · 0.85
unsubscribeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected