sc/math/sc_math.h
Tezc 46d77f2fe6
Dev (#6)
* thread & url

* fix cirrus

* fix thread

* fix thread

* split actions

* test

* fix test

* fix windows thread

* cond & fail-fast

* cond & fail-fast

* cond & fail-fast

* cond & fail-fast

* buffer

* fix swap

* fix big endian

* socket & poll

* socket fix

* kqueue fix

* freebsd

* socket & mmap init

* kqueue

* kqueue

* valgrind

* fix freebsd

* kqueue

* accept fix

* accept fix

* accept fix

* accept fix

* accept fix

* accept fix

* accept fix

* accept fix

* accept fix

* accept fix

* fix big endian fmt

* fix big endian fmt

* mmap

* mmap

* mmap

* mmap

* fix freebsd

* fix 32 bit, mmap

* fix 32 bit, mmap
2020-11-26 19:48:03 +03:00

41 lines
1.5 KiB
C

/*
* MIT License
*
* Copyright (c) 2020 Ozan Tezcan
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef SC_MATH_H
#define SC_MATH_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#define sc_math_max(a, b) ((a) > (b) ? (a) : (b))
#define sc_math_min(a, b) ((a) > (b) ? (b) : (a))
bool sc_math_is_pow2(size_t num);
size_t sc_math_to_pow2(size_t size);
char *sc_math_bytes_to_size(char *buf, size_t max, uint64_t val);
int64_t sc_math_size_to_bytes(const char *buf);
#endif