Lines Matching defs:size
3 /* New version supporting byte order, alignment and size options,
47 Py_ssize_t size;
58 Py_ssize_t size;
355 /* ulargest is the largest unsigned value with f->size bytes.
357 * ((size_t)1 << (f->size * 8)) - 1
358 * doesn't work when f->size == sizeof(size_t) because C doesn't
363 const size_t ulargest = (size_t)-1 >> ((SIZEOF_SIZE_T - f->size)*8);
364 assert(f->size >= 1 && f->size <= SIZEOF_SIZE_T);
812 Py_ssize_t i = f->size;
818 if (SIZEOF_LONG > f->size)
819 x |= -(x & (1L << ((8 * f->size) - 1)));
827 Py_ssize_t i = f->size;
839 Py_ssize_t i = f->size;
845 if (SIZEOF_LONG_LONG > f->size)
846 x |= -(x & ((long long)1 << ((8 * f->size) - 1)));
854 Py_ssize_t i = f->size;
894 i = f->size;
918 i = f->size;
1033 Py_ssize_t i = f->size;
1039 if (SIZEOF_LONG > f->size)
1040 x |= -(x & (1L << ((8 * f->size) - 1)));
1048 Py_ssize_t i = f->size;
1060 Py_ssize_t i = f->size;
1066 if (SIZEOF_LONG_LONG > f->size)
1067 x |= -(x & ((long long)1 << ((8 * f->size) - 1)));
1075 Py_ssize_t i = f->size;
1109 i = f->size;
1133 i = f->size;
1274 /* Align a size according to a format code. Return -1 on overflow. */
1277 align(Py_ssize_t size, char c, const formatdef *e)
1282 if (e->alignment && size > 0) {
1283 extra = (e->alignment - 1) - (size - 1) % (e->alignment);
1284 if (extra > PY_SSIZE_T_MAX - size)
1286 size += extra;
1289 return size;
1296 /* calculate the size of a format string */
1308 Py_ssize_t size, len, num, itemsize;
1323 size = 0;
1360 itemsize = e->size;
1361 size = align(size, c, e);
1362 if (size == -1)
1365 /* if (size + num * itemsize > PY_SSIZE_T_MAX) { ... } */
1366 if (num > (PY_SSIZE_T_MAX - size) / itemsize)
1368 size += num * itemsize;
1377 self->s_size = size;
1390 size = 0;
1404 size = align(size, c, e);
1406 codes->offset = size;
1407 codes->size = num;
1411 size += num;
1413 size += num;
1415 codes->offset = size;
1416 codes->size = e->size;
1420 size += e->size * num;
1424 codes->offset = size;
1425 codes->size = 0;
1432 "total struct size too long");
1546 v = PyBytes_FromStringAndSize(res, code->size);
1549 if (n >= code->size)
1550 n = code->size - 1;
1558 res += code->size;
1577 Unpack according to the format string Struct.format. The buffer's size
1578 in bytes must be Struct.size.
1608 The buffer's size in bytes, starting at position offset, must be
1609 at least Struct.size.
1645 "(actual buffer size is %zd)",
1760 Requires that the bytes length be a multiple of the struct size.
1846 if (n > code->size)
1847 n = code->size;
1868 if (n > (code->size - 1))
1869 n = code->size - 1;
1883 res += code->size;
2018 "(actual buffer size is %zd)",
2051 "S.__sizeof__() -> size of S in memory, in bytes");
2056 Py_ssize_t size;
2059 size = _PyObject_SIZE(Py_TYPE(self)) + sizeof(formatcode);
2061 size += sizeof(formatcode);
2062 return PyLong_FromSsize_t(size);
2084 {"size", (getter)s_get_size, (setter)NULL, "struct size in bytes", NULL},
2186 Return size in bytes of the struct described by the format string.
2259 The buffer's size in bytes must be calcsize(format).
2281 The buffer's size, minus offset, must be at least calcsize(format).
2306 Requires that the bytes length be a multiple of the format struct size.
2337 The optional first format char indicates byte order, size and alignment:\n\
2338 @: native order, size & alignment (default)\n\
2339 =: native order, std. size & alignment\n\
2340 <: little-endian, std. size & alignment\n\
2341 >: big-endian, std. size & alignment\n\
2436 size matches */
2437 if (ptr->size != native->size)
2443 /* Skip _Bool, semantics are different for standard size */