some small fixes

This commit is contained in:
timerix 2024-05-06 17:22:38 +05:00
parent 3329837974
commit c30a23669b
2 changed files with 7 additions and 3 deletions

View File

@ -63,7 +63,11 @@ static inline i32 cptr_lastIndexOfChar(const char* src, char fragment)
static inline bool cptr_contains(const char* src, const char* fragment){
return cptr_seek(src, fragment, 0, -1) +1;
return cptr_seek(src, fragment, 0, -1) != -1;
}
static inline bool cptr_containsChar(const char* src, char c){
return cptr_seekChar(src, c, 0, -1) != -1;
}
char* __cptr_concat(u32 n, ...);

View File

@ -57,8 +57,8 @@ static inline i32 krand_next32(krand_statePtr state, i32 from, i32 to) __krand_n
static inline i64 krand_next64(krand_statePtr state, i64 from, i64 to) __krand_next_definition(64)
// divides random number by 2^64 to return a value between 0 and 1
static inline f32 krand_nextFloat32(krand_statePtr state) {return (u32)KRAND_ALG32_next(state)/0xffffffff; }
static inline f64 krand_nextFloat64(krand_statePtr state) {return KRAND_ALG64_next(state)/0xffffffff; }
static inline f32 krand_nextFloat32(krand_statePtr state) {return (f32)KRAND_ALG32_next(state) / (u32)(-1); }
static inline f64 krand_nextFloat64(krand_statePtr state) {return (f64)KRAND_ALG64_next(state) / (u64)(-1); }
///@param chance (0-1.0) is probability of success