Move tensorflow/core/lib/core/coding to tensorflow/core/platform
PiperOrigin-RevId: 283166018 Change-Id: I7123412386eeb448ca01ea27b859292128a35cad
This commit is contained in:
parent
699e26023a
commit
9a691fd496
@ -2260,6 +2260,7 @@ cc_library(
|
||||
"//tensorflow/core/lib/strings:strcat",
|
||||
"//tensorflow/core/lib/strings:stringprintf",
|
||||
"//tensorflow/core/platform:abi",
|
||||
"//tensorflow/core/platform:coding",
|
||||
"//tensorflow/core/platform:context",
|
||||
"//tensorflow/core/platform:cord",
|
||||
"//tensorflow/core/platform:cpu_feature_guard",
|
||||
|
||||
@ -53,13 +53,9 @@ cc_library(
|
||||
|
||||
cc_library(
|
||||
name = "coding",
|
||||
srcs = ["coding.cc"],
|
||||
hdrs = ["coding.h"],
|
||||
deps = [
|
||||
"//tensorflow/core/lib/core:raw_coding",
|
||||
"//tensorflow/core/lib/core:stringpiece",
|
||||
"//tensorflow/core/platform:byte_order",
|
||||
"//tensorflow/core/platform:types",
|
||||
"//tensorflow/core/platform:coding",
|
||||
],
|
||||
)
|
||||
|
||||
@ -172,7 +168,6 @@ filegroup(
|
||||
srcs = [
|
||||
"arena.cc",
|
||||
"bitmap.cc",
|
||||
"coding.cc",
|
||||
],
|
||||
visibility = ["//tensorflow/core:__pkg__"],
|
||||
)
|
||||
|
||||
@ -21,49 +21,6 @@ limitations under the License.
|
||||
#ifndef TENSORFLOW_CORE_LIB_CORE_CODING_H_
|
||||
#define TENSORFLOW_CORE_LIB_CORE_CODING_H_
|
||||
|
||||
#include "tensorflow/core/lib/core/raw_coding.h"
|
||||
#include "tensorflow/core/lib/core/stringpiece.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
namespace tensorflow {
|
||||
namespace core {
|
||||
|
||||
// Maximum number of bytes occupied by a varint32.
|
||||
static const int kMaxVarint32Bytes = 5;
|
||||
|
||||
// Maximum number of bytes occupied by a varint64.
|
||||
static const int kMaxVarint64Bytes = 10;
|
||||
|
||||
// Lower-level versions of Put... that write directly into a character buffer
|
||||
// REQUIRES: dst has enough space for the value being written
|
||||
extern void EncodeFixed16(char* dst, uint16 value);
|
||||
extern void EncodeFixed32(char* dst, uint32 value);
|
||||
extern void EncodeFixed64(char* dst, uint64 value);
|
||||
extern void PutFixed16(string* dst, uint16 value);
|
||||
extern void PutFixed32(string* dst, uint32 value);
|
||||
extern void PutFixed64(string* dst, uint64 value);
|
||||
|
||||
extern void PutVarint32(string* dst, uint32 value);
|
||||
extern void PutVarint64(string* dst, uint64 value);
|
||||
|
||||
extern bool GetVarint32(StringPiece* input, uint32* value);
|
||||
extern bool GetVarint64(StringPiece* input, uint64* value);
|
||||
|
||||
extern const char* GetVarint32Ptr(const char* p, const char* limit, uint32* v);
|
||||
extern const char* GetVarint64Ptr(const char* p, const char* limit, uint64* v);
|
||||
|
||||
// Internal routine for use by fallback path of GetVarint32Ptr
|
||||
extern const char* GetVarint32PtrFallback(const char* p, const char* limit,
|
||||
uint32* value);
|
||||
extern const char* GetVarint32Ptr(const char* p, const char* limit,
|
||||
uint32* value);
|
||||
extern char* EncodeVarint32(char* dst, uint32 v);
|
||||
extern char* EncodeVarint64(char* dst, uint64 v);
|
||||
|
||||
// Returns the length of the varint32 or varint64 encoding of "v"
|
||||
extern int VarintLength(uint64_t v);
|
||||
|
||||
} // namespace core
|
||||
} // namespace tensorflow
|
||||
#include "tensorflow/core/platform/coding.h"
|
||||
|
||||
#endif // TENSORFLOW_CORE_LIB_CORE_CODING_H_
|
||||
|
||||
@ -88,6 +88,18 @@ cc_library(
|
||||
hdrs = ["byte_order.h"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "coding",
|
||||
srcs = ["coding.cc"],
|
||||
hdrs = ["coding.h"],
|
||||
deps = [
|
||||
":byte_order",
|
||||
":raw_coding",
|
||||
":stringpiece",
|
||||
":types",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "context",
|
||||
textual_hdrs = ["context.h"],
|
||||
@ -746,6 +758,7 @@ filegroup(
|
||||
"**/unbounded_work_queue.cc",
|
||||
"**/windows_file_system.cc",
|
||||
"abi.cc",
|
||||
"coding.cc",
|
||||
"cpu_info.cc",
|
||||
"hash.cc",
|
||||
"numbers.cc",
|
||||
@ -852,6 +865,7 @@ filegroup(
|
||||
"**/human_readable_json.cc",
|
||||
"**/rocm_rocdl_path.cc",
|
||||
"abi.cc",
|
||||
"coding.cc",
|
||||
"cpu_info.cc",
|
||||
"cpu_feature_guard.cc",
|
||||
"denormal.cc",
|
||||
|
||||
@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "tensorflow/core/lib/core/coding.h"
|
||||
#include "tensorflow/core/platform/coding.h"
|
||||
|
||||
#include "tensorflow/core/platform/byte_order.h"
|
||||
|
||||
69
tensorflow/core/platform/coding.h
Normal file
69
tensorflow/core/platform/coding.h
Normal file
@ -0,0 +1,69 @@
|
||||
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
// Endian-neutral encoding:
|
||||
// * Fixed-length numbers are encoded with least-significant byte first
|
||||
// * In addition we support variable length "varint" encoding
|
||||
// * Strings are encoded prefixed by their length in varint format
|
||||
|
||||
#ifndef TENSORFLOW_CORE_PLATFORM_CODING_H_
|
||||
#define TENSORFLOW_CORE_PLATFORM_CODING_H_
|
||||
|
||||
#include "tensorflow/core/platform/raw_coding.h"
|
||||
#include "tensorflow/core/platform/stringpiece.h"
|
||||
#include "tensorflow/core/platform/types.h"
|
||||
|
||||
namespace tensorflow {
|
||||
namespace core {
|
||||
|
||||
// Maximum number of bytes occupied by a varint32.
|
||||
static const int kMaxVarint32Bytes = 5;
|
||||
|
||||
// Maximum number of bytes occupied by a varint64.
|
||||
static const int kMaxVarint64Bytes = 10;
|
||||
|
||||
// Lower-level versions of Put... that write directly into a character buffer
|
||||
// REQUIRES: dst has enough space for the value being written
|
||||
extern void EncodeFixed16(char* dst, uint16 value);
|
||||
extern void EncodeFixed32(char* dst, uint32 value);
|
||||
extern void EncodeFixed64(char* dst, uint64 value);
|
||||
extern void PutFixed16(string* dst, uint16 value);
|
||||
extern void PutFixed32(string* dst, uint32 value);
|
||||
extern void PutFixed64(string* dst, uint64 value);
|
||||
|
||||
extern void PutVarint32(string* dst, uint32 value);
|
||||
extern void PutVarint64(string* dst, uint64 value);
|
||||
|
||||
extern bool GetVarint32(StringPiece* input, uint32* value);
|
||||
extern bool GetVarint64(StringPiece* input, uint64* value);
|
||||
|
||||
extern const char* GetVarint32Ptr(const char* p, const char* limit, uint32* v);
|
||||
extern const char* GetVarint64Ptr(const char* p, const char* limit, uint64* v);
|
||||
|
||||
// Internal routine for use by fallback path of GetVarint32Ptr
|
||||
extern const char* GetVarint32PtrFallback(const char* p, const char* limit,
|
||||
uint32* value);
|
||||
extern const char* GetVarint32Ptr(const char* p, const char* limit,
|
||||
uint32* value);
|
||||
extern char* EncodeVarint32(char* dst, uint32 v);
|
||||
extern char* EncodeVarint64(char* dst, uint64 v);
|
||||
|
||||
// Returns the length of the varint32 or varint64 encoding of "v"
|
||||
extern int VarintLength(uint64_t v);
|
||||
|
||||
} // namespace core
|
||||
} // namespace tensorflow
|
||||
|
||||
#endif // TENSORFLOW_CORE_PLATFORM_CODING_H_
|
||||
Loading…
x
Reference in New Issue
Block a user