30 #ifndef CLIENT_LINUX_MINIDUMP_WRITER_CPU_SET_H_ 31 #define CLIENT_LINUX_MINIDUMP_WRITER_CPU_SET_H_ 57 int ret = sys_read(fd, buffer,
sizeof(buffer)-1);
71 const char* p = buffer;
72 const char* p_end = p + ret;
80 size_t item_len =
static_cast<size_t>(p_end - p);
81 const char* item_next =
82 static_cast<const char*
>(
my_memchr(p,
',', item_len));
83 if (item_next != NULL) {
85 item_len =
static_cast<size_t>(item_next - item);
92 while (item_next > item &&
my_isspace(item_next[-1]))
96 if (item_next == item)
102 uintptr_t end = start;
114 for (
size_t nn = 0; nn < kMaskWordCount; ++nn)
115 mask_[nn] &= other.mask_[nn];
121 for (
size_t nn = 0; nn < kMaskWordCount; ++nn) {
122 result += __builtin_popcount(mask_[nn]);
128 void SetBit(uintptr_t index) {
129 size_t nn =
static_cast<size_t>(index);
131 mask_[nn / kMaskWordBits] |= (1U << (nn % kMaskWordBits));
134 typedef uint32_t MaskWordType;
135 static const size_t kMaskWordBits = 8*
sizeof(MaskWordType);
136 static const size_t kMaskWordCount =
137 (kMaxCpus + kMaskWordBits - 1) / kMaskWordBits;
139 MaskWordType mask_[kMaskWordCount];
144 #endif // CLIENT_LINUX_MINIDUMP_WRITER_CPU_SET_H_ static const size_t kMaxCpus
bool ParseSysFile(int fd)
const char * my_read_decimal_ptr(uintptr_t *result, const char *s)
void * my_memchr(const void *src, int c, size_t len)
void IntersectWith(const CpuSet &other)
void my_memset(void *ip, char c, size_t len)