# libc: implement common \`abs\` for various integer sizes \(\#23893\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/55848363fd5c88bd6313880e770515a9c548c0df)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 55848363fd5c88bd6313880e770515a9c548c0df

Requested commit: 55848363fd5c88bd6313880e770515a9c548c0df

Commit: 55848363fd5c88bd6313880e770515a9c548c0df

Tree: 1c2cb9fe2d20f6273d41e238aa366f775611f413

Author: David

Committer: GitHub

## Message

```
libc: implement common `abs` for various integer sizes (#23893)

* libc: implement common `abs` for various integer sizes

* libc: move imaxabs to inttypes.zig and don't use cInclude

* libc: delete `fabs` c implementations because already implemented in compiler_rt

* libc: export functions depending on the target libc

Previously all the functions that were exported were handled equally,
though some may exist and some not inside the same file. Moving the
checks inside the file allows handling different functions differently

* remove empty ifs in inttypes

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>

* remove empty ifs in stdlib

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>

* libc: use `@abs` for the absolute value calculation

---------

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
```

## Parents

- [a63f7875f451bda975ddabcc0c1feed10a216516](https://git.cafe/gitcafe/zig/commit/a63f7875f451bda975ddabcc0c1feed10a216516?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/55848363fd5c88bd6313880e770515a9c548c0df?format=markdown)
