obsidian-notes/代码/四舍五入.md

16 lines
531 B
Markdown
Raw Normal View History

2024-04-15 03:19:57 +00:00
---
title: 四舍五入
updated: 2022-01-11 01:26:58Z
created: 2022-01-11 01:26:57Z
---
四舍五入
```c
#define do_div(n, base) ({ \
uint64_t __base = (base); \
uint64_t __rem; \
__rem = ((uint64_t)(n)) % __base; \
(n) = ((uint64_t)(n)) / __base; \
__rem; \
})
```