(value, map)
| 112 | @Return (Object) key-value mapped dictionary |
| 113 | */ |
| 114 | function MapFlags(value, map) { |
| 115 | var res = {}; |
| 116 | for (var bit = 1; (value < 0 || bit <= value) && bit !== 0; bit <<= 1) |
| 117 | if (value & bit) res[map[bit]] = true; //If value and the bit are equal then map the value to the result |
| 118 | |
| 119 | return res; |
| 120 | } |
| 121 | |
| 122 | function ParseCommand(type, data, size, off) { |
| 123 | var cmd = null; |