Annotation of solidite/utils/include/flags.h, revision 1.1

1.1     ! user        1: /* Copyright (c) 2026 The Solidite Developers
        !             2:  *
        !             3:  * This program is free software: you can redistribute it and/or modify it under
        !             4:  * the terms of the GNU Affero General Public License as published by the Free
        !             5:  * Software Foundation, either version 3 of the License, or (at your option)
        !             6:  * any later version.
        !             7:  *
        !             8:  * This program is distributed in the hope that it will be useful, but WITHOUT
        !             9:  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
        !            10:  * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
        !            11:  * details.
        !            12:  *
        !            13:  * You should have received a copy of the GNU Affero General Public License
        !            14:  * along with this program. If not, see <https://www.gnu.org/licenses/>. */
        !            15: 
        !            16: #ifndef __FLAGS_H__
        !            17: #define __FLAGS_H__
        !            18: 
        !            19: #include <stdint.h>
        !            20: 
        !            21: static inline void set_flag(unsigned long *flags, const int POSITION) {
        !            22:   *flags |= (1 << POSITION);
        !            23: }
        !            24: 
        !            25: static inline void unset_flag(unsigned long* flags, const int POSITION) {
        !            26:   *flags &= ~(1 << POSITION);
        !            27: }
        !            28: 
        !            29: static inline int read_flag(unsigned long* flags, const int POSITION) {
        !            30:   return (*flags & (1 << POSITION)) != 0;
        !            31: }
        !            32: 
        !            33: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>