MCPcopy Create free account
hub / github.com/numpy/numpy / extract_unit_32

Function extract_unit_32

numpy/core/src/multiarray/datetime.c:57–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57static inline
58npy_int32 extract_unit_32(npy_int32 *d, npy_int32 unit) {
59 assert(unit > 0);
60 npy_int32 div = *d / unit;
61 npy_int32 mod = *d % unit;
62 if (mod < 0) {
63 mod += unit;
64 div -= 1;
65 }
66 assert(mod >= 0);
67 *d = mod;
68 return div;
69}
70
71/*
72 * Imports the PyDateTime functions so we can create these objects.

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected