chromium/components/cbor/constants.h

// Copyright 2017 The Chromium Authors
// 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 =;
// 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 =;
// 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 =;
// Indicates the integer is in the following byte.
static constexpr uint8_t kAdditionalInformation1Byte =;
// Indicates the integer is in the next 2 bytes.
static constexpr uint8_t kAdditionalInformation2Bytes =;
// Indicates the integer is in the next 4 bytes.
static constexpr uint8_t kAdditionalInformation4Bytes =;
// Indicates the integer is in the next 8 bytes.
static constexpr uint8_t kAdditionalInformation8Bytes =;

extern const char kUnsupportedMajorType[];

}  // namespace constants
}  // namespace cbor

#endif  // COMPONENTS_CBOR_CONSTANTS_H_