@@ -71,57 +71,6 @@ static inline void default_new(T *&p) { p = new T(); }
7171template <class T >
7272static inline void default_new (std::unique_ptr<T> &p) { p.reset (new T ()); }
7373
74- template <typename T, typename Impl>
75- class stateless_allocator {
76- public:
77- using value_type = T;
78- T *allocate (size_t num) { return static_cast <T*>(Impl::allocate (sizeof (T) * num)); }
79- void deallocate (T *ptr, size_t num) { Impl::deallocate (ptr, sizeof (T) * num); }
80- stateless_allocator () = default ;
81- stateless_allocator (const stateless_allocator&) = default ;
82- stateless_allocator (stateless_allocator&&) = default ;
83- template <typename U>
84- stateless_allocator (const stateless_allocator<U, Impl>&) {}
85- bool operator ==(const stateless_allocator&) { return true ; }
86- bool operator !=(const stateless_allocator&) { return false ; }
87- };
88-
89- class dynamic_bitset_impl {
90- public:
91- using slot_type = unsigned long ;
92- constexpr static int slot_size = sizeof (slot_type) * 8 ;
93- using slot_bits = std::bitset<slot_size>;
94-
95- size_t slots () const { return slot_list.size (); }
96- slot_type get_slot (size_t slot) const {
97- return slot_list.size () > slot ? slot_list[slot].to_ulong () : 0ul ;
98- }
99- void emplace_back (slot_type l) {
100- slot_list.emplace_back (l);
101- }
102- protected:
103- slot_bits::reference get (size_t pos) {
104- size_t slot = pos / slot_size;
105- size_t index = pos % slot_size;
106- if (slot_list.size () <= slot) {
107- slot_list.resize (slot + 1 );
108- }
109- return slot_list[slot][index];
110- }
111- bool get (size_t pos) const {
112- size_t slot = pos / slot_size;
113- size_t index = pos % slot_size;
114- return slot_list.size () > slot && slot_list[slot][index];
115- }
116- private:
117- std::vector<slot_bits> slot_list;
118- };
119-
120- struct dynamic_bitset : public dynamic_bitset_impl {
121- slot_bits::reference operator [] (size_t pos) { return get (pos); }
122- bool operator [] (size_t pos) const { return get (pos); }
123- };
124-
12574struct StringCmp {
12675 using is_transparent = void ;
12776 bool operator ()(std::string_view a, std::string_view b) const { return a < b; }
@@ -198,13 +147,6 @@ struct byte_data : public byte_view {
198147 rust::Vec<size_t > patch (byte_view from, byte_view to);
199148};
200149
201- template <size_t N>
202- struct byte_array : public byte_data {
203- byte_array () : byte_data(arr, N), arr{0 } {}
204- private:
205- uint8_t arr[N];
206- };
207-
208150class byte_stream ;
209151
210152struct heap_data : public byte_data {
@@ -238,7 +180,6 @@ rust::Vec<size_t> mut_u8_patch(
238180 rust::Slice<const uint8_t > from,
239181 rust::Slice<const uint8_t > to);
240182
241- uint64_t parse_uint64_hex (std::string_view s);
242183int parse_int (std::string_view s);
243184
244185using thread_entry = void *(*)(void *);
@@ -270,11 +211,9 @@ int fork_dont_care();
270211int fork_no_orphan ();
271212void init_argv0 (int argc, char **argv);
272213void set_nice_name (const char *name);
273- uint32_t binary_gcd (uint32_t u, uint32_t v);
274214int switch_mnt_ns (int pid);
275215std::string &replace_all (std::string &str, std::string_view from, std::string_view to);
276216std::vector<std::string> split (std::string_view s, std::string_view delims);
277- std::vector<std::string_view> split_view (std::string_view, std::string_view delims);
278217
279218// Similar to vsnprintf, but the return value is the written number of bytes
280219__printflike (3 , 0 ) int vssprintf(char *dest, size_t size, const char *fmt, va_list ap);
0 commit comments