/* V2MemTest - A CLI Tool to test & fix Voodoo² TMU System * Copyright (C) 2026 ChaCha * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef _DEF_UTILS_H_ #define _DEF_UTILS_H_ #include static inline unsigned char count_bit32(const uint32_t ulVal) { unsigned char cpt = 0; for(uint32_t idxBit = 1<<31;idxBit>0;idxBit>>=1) if(ulVal & idxBit) cpt++; return cpt; } static inline unsigned char count_bit8(const uint8_t ulVal) { unsigned char cpt = 0; for(uint8_t idxBit = 1<<7;idxBit>0;idxBit>>=1) if(ulVal & idxBit) cpt++; return cpt; } void printbin32( const uint32_t ulVal, const unsigned char bGroupByBytes); void printbin32Info( const uint32_t ulVal, const unsigned short uhb, const unsigned short ulb); uint32_t get_notnull_random(); uint32_t get_notnull_random_balanced(); uint8_t get_notnull8_random_balanced(); uint32_t get_notnull_random_balanced_mByte(); #endif //_DEF_UTILS_H_