Merge branch 'iso646' into 'master'

Add iso646.h and corresponding tests

See merge request redox-os/relibc!555

Changed files
+148
include
tests
+22
include/iso646.h
··· 1 + // Copied from musl 2 + 3 + #ifndef _ISO646_H 4 + #define _ISO646_H 5 + 6 + #ifndef __cplusplus 7 + 8 + #define and && 9 + #define and_eq &= 10 + #define bitand & 11 + #define bitor | 12 + #define compl ~ 13 + #define not ! 14 + #define not_eq != 15 + #define or || 16 + #define or_eq |= 17 + #define xor ^ 18 + #define xor_eq ^= 19 + 20 + #endif 21 + 22 + #endif
+1
tests/Makefile
··· 22 22 features \ 23 23 fnmatch \ 24 24 futimens \ 25 + iso646 \ 25 26 libgen \ 26 27 locale \ 27 28 math \
tests/expected/bins_static/iso646.stderr

This is a binary file and will not be displayed.

+33
tests/expected/bins_static/iso646.stdout
··· 1 + 0 and 0: 0 2 + 1 and 0: 0 3 + 0 and 1: 0 4 + 1 and 1: 1 5 + 0 and_eq 0: 0 6 + 1 and_eq 0: 0 7 + 0 and_eq 1: 0 8 + 1 and_eq 1: 1 9 + a bitand b: 8 10 + a bitor b: 14 11 + compl a: 245 12 + not 0: 1 13 + not 1: 0 14 + 0 not_eq 0: 0 15 + 1 not_eq 0: 1 16 + 0 not_eq 1: 0 17 + 1 not_eq 1: 1 18 + 0 or 0: 0 19 + 1 or 0: 1 20 + 0 or 1: 1 21 + 1 or 1: 1 22 + 0 or_eq 0: 0 23 + 1 or_eq 0: 1 24 + 0 or_eq 1: 1 25 + 1 or_eq 1: 1 26 + 0 xor 0: 0 27 + 1 xor 0: 1 28 + 0 xor 1: 1 29 + 1 xor 1: 0 30 + 0 xor_eq 0: 0 31 + 1 xor_eq 0: 1 32 + 0 xor_eq 1: 1 33 + 1 xor_eq 1: 0
+92
tests/iso646.c
··· 1 + #include <iso646.h> 2 + #include <stdint.h> 3 + #include <stdio.h> 4 + 5 + #include "test_helpers.h" 6 + 7 + int main() { 8 + uint8_t a_bits = 0xa; // 0b0000_1010 9 + uint8_t b_bits = 0xc; // 0b0000_1100 10 + 11 + uint8_t c_bits; 12 + int c_bool; 13 + 14 + printf("0 and 0: %d\n", 0 and 0); 15 + printf("1 and 0: %d\n", 1 and 0); 16 + printf("0 and 1: %d\n", 0 and 1); 17 + printf("1 and 1: %d\n", 1 and 1); 18 + 19 + c_bool = 0; 20 + c_bool and_eq 0; 21 + printf("0 and_eq 0: %d\n", c_bool); 22 + c_bool = 1; 23 + c_bool and_eq 0; 24 + printf("1 and_eq 0: %d\n", c_bool); 25 + c_bool = 0; 26 + c_bool and_eq 1; 27 + printf("0 and_eq 1: %d\n", c_bool); 28 + c_bool = 1; 29 + c_bool and_eq 1; 30 + printf("1 and_eq 1: %d\n", c_bool); 31 + 32 + c_bits = a_bits bitand b_bits; 33 + printf("a bitand b: %d\n", c_bits); 34 + 35 + c_bits = a_bits bitor b_bits; 36 + printf("a bitor b: %d\n", c_bits); 37 + 38 + c_bits = compl a_bits; 39 + printf("compl a: %d\n", c_bits); 40 + 41 + printf("not 0: %d\n", not 0); 42 + printf("not 1: %d\n", not 1); 43 + 44 + c_bool = 0; 45 + c_bool not_eq 0; 46 + printf("0 not_eq 0: %d\n", c_bool); 47 + c_bool = 1; 48 + c_bool not_eq 0; 49 + printf("1 not_eq 0: %d\n", c_bool); 50 + c_bool = 0; 51 + c_bool not_eq 1; 52 + printf("0 not_eq 1: %d\n", c_bool); 53 + c_bool = 1; 54 + c_bool not_eq 1; 55 + printf("1 not_eq 1: %d\n", c_bool); 56 + 57 + printf("0 or 0: %d\n", 0 or 0); 58 + printf("1 or 0: %d\n", 1 or 0); 59 + printf("0 or 1: %d\n", 0 or 1); 60 + printf("1 or 1: %d\n", 1 or 1); 61 + 62 + c_bool = 0; 63 + c_bool or_eq 0; 64 + printf("0 or_eq 0: %d\n", c_bool); 65 + c_bool = 1; 66 + c_bool or_eq 0; 67 + printf("1 or_eq 0: %d\n", c_bool); 68 + c_bool = 0; 69 + c_bool or_eq 1; 70 + printf("0 or_eq 1: %d\n", c_bool); 71 + c_bool = 1; 72 + c_bool or_eq 1; 73 + printf("1 or_eq 1: %d\n", c_bool); 74 + 75 + printf("0 xor 0: %d\n", 0 xor 0); 76 + printf("1 xor 0: %d\n", 1 xor 0); 77 + printf("0 xor 1: %d\n", 0 xor 1); 78 + printf("1 xor 1: %d\n", 1 xor 1); 79 + 80 + c_bool = 0; 81 + c_bool xor_eq 0; 82 + printf("0 xor_eq 0: %d\n", c_bool); 83 + c_bool = 1; 84 + c_bool xor_eq 0; 85 + printf("1 xor_eq 0: %d\n", c_bool); 86 + c_bool = 0; 87 + c_bool xor_eq 1; 88 + printf("0 xor_eq 1: %d\n", c_bool); 89 + c_bool = 1; 90 + c_bool xor_eq 1; 91 + printf("1 xor_eq 1: %d\n", c_bool); 92 + }