GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — async-profiler/src/protobuf.h at jonoffcpu-dev · jonoffcpu/async-profiler

Expand file tree

/

protobuf.h

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
59 lines (44 loc) · 1.49 KB
/

protobuf.h

Copy path

File metadata and controls

59 lines (44 loc) · 1.49 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright The async-profiler authors
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _PROTOBUF_H
#define _PROTOBUF_H
#include <sys/types.h>
#include "arch.h"
typedef const u32 protobuf_t;
protobuf_t VARINT = 0;
protobuf_t I64 = 1;
protobuf_t LEN = 2;
typedef u32 protobuf_index_t;
// 3 bits for the maximum byte count for the message size
// 61 bits for the message start
typedef u64 protobuf_mark_t;
const size_t NESTED_FIELD_BYTE_COUNT = 5;
const size_t MINIMUM_INITIAL_SIZE = 16;
class ProtoBuffer {
private:
unsigned char* _data;
size_t _capacity;
size_t _offset;
void tag(protobuf_index_t index, protobuf_t type);
void ensureCapacity(size_t new_data_size);
public:
ProtoBuffer(size_t initial_capacity);
~ProtoBuffer();
const unsigned char* data() const { return _data; }
size_t offset() const { return _offset; }
size_t capacity() const { return _capacity; }
unsigned char* release();
void field(protobuf_index_t index, u64 n);
void fieldFixed64(protobuf_index_t index, u64 n);
// LEN
void field(protobuf_index_t index, const char* s);
void field(protobuf_index_t index, const char* s, size_t len);
void field(protobuf_index_t index, const unsigned char* s, size_t len);
protobuf_mark_t startMessage(protobuf_index_t index, size_t max_len_byte_count = NESTED_FIELD_BYTE_COUNT);
void commitMessage(protobuf_mark_t mark);
void putVarInt(u64 n);
static size_t varIntSize(u64 value);
};
#endif // _PROTOBUF_H
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.