|  | // Copyright 2017 The Chromium Authors. All rights reserved. | 
|  | // Use of this source code is governed by a BSD-style license that can be | 
|  | // found in the LICENSE file. | 
|  |  | 
|  | #ifndef COMPONENTS_CBOR_CONSTANTS_H_ | 
|  | #define COMPONENTS_CBOR_CONSTANTS_H_ | 
|  |  | 
|  | #include <stdint.h> | 
|  |  | 
|  | namespace cbor { | 
|  | namespace constants { | 
|  |  | 
|  | // Mask selecting the low-order 5 bits of the "initial byte", which is where | 
|  | // the additional information is encoded. | 
|  | static constexpr uint8_t kAdditionalInformationMask = 0x1F; | 
|  | // Mask selecting the high-order 3 bits of the "initial byte", which indicates | 
|  | // the major type of the encoded value. | 
|  | static constexpr uint8_t kMajorTypeMask = 0xE0; | 
|  | // Indicates the number of bits the "initial byte" needs to be shifted to the | 
|  | // right after applying |kMajorTypeMask| to produce the major type in the | 
|  | // lowermost bits. | 
|  | static constexpr uint8_t kMajorTypeBitShift = 5u; | 
|  | // Indicates the integer is in the following byte. | 
|  | static constexpr uint8_t kAdditionalInformation1Byte = 24u; | 
|  | // Indicates the integer is in the next 2 bytes. | 
|  | static constexpr uint8_t kAdditionalInformation2Bytes = 25u; | 
|  | // Indicates the integer is in the next 4 bytes. | 
|  | static constexpr uint8_t kAdditionalInformation4Bytes = 26u; | 
|  | // Indicates the integer is in the next 8 bytes. | 
|  | static constexpr uint8_t kAdditionalInformation8Bytes = 27u; | 
|  |  | 
|  | extern const char kUnsupportedMajorType[]; | 
|  |  | 
|  | }  // namespace constants | 
|  | }  // namespace cbor | 
|  |  | 
|  | #endif  // COMPONENTS_CBOR_CONSTANTS_H_ |