comparison test/bitfield.c @ 365:5ac17fa9d7e0

bit-field constant assignment
author kono
date Wed, 07 Jul 2004 14:34:25 +0900
parents 7fe7ce0a791f
children 8b9136a06f56
comparison
equal deleted inserted replaced
364:c29eebf3eaf4 365:5ac17fa9d7e0
18 unsigned long :1; 18 unsigned long :1;
19 unsigned long pp:2; 19 unsigned long pp:2;
20 long long lpn:40; 20 long long lpn:40;
21 } pte; 21 } pte;
22 struct { 22 struct {
23 unsigned char v:1; 23 char v:1;
24 signed long vsid:24; 24 signed long vsid:24;
25 unsigned long h:1; 25 unsigned long h:1;
26 signed char api:6; 26 signed char api:6;
27 signed long rpn:20; 27 signed long rpn:20;
28 28
189 printf("%d %d %d\n",a.pte.pp,g.pte.pp,p->pte.pp); 189 printf("%d %d %d\n",a.pte.pp,g.pte.pp,p->pte.pp);
190 main2(); 190 main2();
191 main5(); 191 main5();
192 main3(); 192 main3();
193 main4(); 193 main4();
194 main6();
195 main7();
194 return 0; 196 return 0;
195 } 197 }
196 198
197 main2() 199 main2()
198 { 200 {
735 printf("main3l-30: %d\n",b); 737 printf("main3l-30: %d\n",b);
736 738
737 return --b; 739 return --b;
738 } 740 }
739 741
742
743 main6()
744 {
745 int i =0;
746 g.pte.api = 0;
747 printf("main5: %d %d\n",i++,g.pte.api);
748 g.pte.api = 1;
749 printf("main5: %d %d\n",i++,g.pte.api);
750 g.pte.api = 2;
751 printf("main5: %d %d\n",i++,g.pte.api);
752 g.pte.api = 3;
753 printf("main5: %d %d\n",i++,g.pte.api);
754 g.pte.api = 4;
755 printf("main5: %d %d\n",i++,g.pte.api);
756 g.pte.api = 5;
757 printf("main5: %d %d\n",i++,g.pte.api);
758 g.pte.api = 6;
759 printf("main5: %d %d\n",i++,g.pte.api);
760 g.pte.api = 7;
761 printf("main5: %d %d\n",i++,g.pte.api);
762 g.pte.api = 8;
763 printf("main5: %d %d\n",i++,g.pte.api);
764 g.pte.api = 9;
765 printf("main5: %d %d\n",i++,g.pte.api);
766 g.pte.api = 10;
767 printf("main5: %d %d\n",i++,g.pte.api);
768 g.pte.api = 11;
769 printf("main5: %d %d\n",i++,g.pte.api);
770 g.pte.api = 12;
771 printf("main5: %d %d\n",i++,g.pte.api);
772 g.pte.api = 13;
773 printf("main5: %d %d\n",i++,g.pte.api);
774 g.pte.api = 14;
775 printf("main5: %d %d\n",i++,g.pte.api);
776 g.pte.api = 15;
777 printf("main5: %d %d\n",i++,g.pte.api);
778 g.pte.api = 16;
779 printf("main5: %d %d\n",i++,g.pte.api);
780 g.pte.api = 17;
781 printf("main5: %d %d\n",i++,g.pte.api);
782 g.pte.api = 18;
783 printf("main5: %d %d\n",i++,g.pte.api);
784 g.pte.api = 19;
785 printf("main5: %d %d\n",i++,g.pte.api);
786 g.pte.api = 20;
787 printf("main5: %d %d\n",i++,g.pte.api);
788 g.pte.api = 21;
789 printf("main5: %d %d\n",i++,g.pte.api);
790 g.pte.api = 22;
791 printf("main5: %d %d\n",i++,g.pte.api);
792 g.pte.api = 23;
793 printf("main5: %d %d\n",i++,g.pte.api);
794 g.pte.api = 24;
795 printf("main5: %d %d\n",i++,g.pte.api);
796 g.pte.api = 25;
797 printf("main5: %d %d\n",i++,g.pte.api);
798 g.pte.api = 26;
799 printf("main5: %d %d\n",i++,g.pte.api);
800 g.pte.api = 27;
801 printf("main5: %d %d\n",i++,g.pte.api);
802 g.pte.api = 28;
803 printf("main5: %d %d\n",i++,g.pte.api);
804 g.pte.api = 29;
805 printf("main5: %d %d\n",i++,g.pte.api);
806 g.pte.api = 30;
807 printf("main5: %d %d\n",i++,g.pte.api);
808 g.pte.api = 31;
809 printf("main5: %d %d\n",i++,g.pte.api);
810 g.pte.api = 32;
811 printf("main5: %d %d\n",i++,g.pte.api);
812 g.pte.api = 33;
813 printf("main5: %d %d\n",i++,g.pte.api);
814 g.pte.api = 34;
815 printf("main5: %d %d\n",i++,g.pte.api);
816 g.pte.api = 35;
817 printf("main5: %d %d\n",i++,g.pte.api);
818 g.pte.api = 36;
819 printf("main5: %d %d\n",i++,g.pte.api);
820 g.pte.api = 37;
821 printf("main5: %d %d\n",i++,g.pte.api);
822 g.pte.api = 38;
823 printf("main5: %d %d\n",i++,g.pte.api);
824 g.pte.api = 39;
825 printf("main5: %d %d\n",i++,g.pte.api);
826 g.pte.api = 40;
827 printf("main5: %d %d\n",i++,g.pte.api);
828 g.pte.api = 41;
829 printf("main5: %d %d\n",i++,g.pte.api);
830 g.pte.api = 42;
831 printf("main5: %d %d\n",i++,g.pte.api);
832 g.pte.api = 43;
833 printf("main5: %d %d\n",i++,g.pte.api);
834 g.pte.api = 44;
835 printf("main5: %d %d\n",i++,g.pte.api);
836 g.pte.api = 45;
837 printf("main5: %d %d\n",i++,g.pte.api);
838 g.pte.api = 46;
839 printf("main5: %d %d\n",i++,g.pte.api);
840 g.pte.api = 47;
841 printf("main5: %d %d\n",i++,g.pte.api);
842 g.pte.api = 48;
843 printf("main5: %d %d\n",i++,g.pte.api);
844 g.pte.api = 49;
845 printf("main5: %d %d\n",i++,g.pte.api);
846 g.pte.api = 50;
847 printf("main5: %d %d\n",i++,g.pte.api);
848 g.pte.api = 51;
849 printf("main5: %d %d\n",i++,g.pte.api);
850 g.pte.api = 52;
851 printf("main5: %d %d\n",i++,g.pte.api);
852 g.pte.api = 53;
853 printf("main5: %d %d\n",i++,g.pte.api);
854 g.pte.api = 54;
855 printf("main5: %d %d\n",i++,g.pte.api);
856 g.pte.api = 55;
857 printf("main5: %d %d\n",i++,g.pte.api);
858 g.pte.api = 56;
859 printf("main5: %d %d\n",i++,g.pte.api);
860 g.pte.api = 57;
861 printf("main5: %d %d\n",i++,g.pte.api);
862 g.pte.api = 58;
863 printf("main5: %d %d\n",i++,g.pte.api);
864 g.pte.api = 59;
865 printf("main5: %d %d\n",i++,g.pte.api);
866 g.pte.api = 60;
867 printf("main5: %d %d\n",i++,g.pte.api);
868 g.pte.api = 61;
869 printf("main5: %d %d\n",i++,g.pte.api);
870 g.pte.api = 62;
871 printf("main5: %d %d\n",i++,g.pte.api);
872 g.pte.api = 63;
873 printf("main5: %d %d\n",i++,g.pte.api);
874 }
875
876 main7()
877 {
878 int i;
879 for (i=-2;i<2;i++) {
880 g.pte.api = i;
881 if (g.pte.api) {
882 printf("main 7:1 %d yes\n",i);
883 } else {
884 printf("main 7:1 %d no\n",i);
885 }
886 if (g.pte.api==1) {
887 printf("main 7:2 %d yes\n",i);
888 } else {
889 printf("main 7:2 %d no\n",i);
890 }
891 if (g.pte.api==-1) {
892 printf("main 7:3 %d yes\n",i);
893 } else {
894 printf("main 7:3 %d no\n",i);
895 }
896 }
897 for (i=-2;i<2;i++) {
898 g.sg.v = i;
899 if (g.sg.v) {
900 printf("main 7:4 %d yes\n",i);
901 } else {
902 printf("main 7:4 %d no\n",i);
903 }
904 if (g.sg.v==1) {
905 printf("main 7:5 %d yes\n",i);
906 } else {
907 printf("main 7:5 %d no\n",i);
908 }
909 if (g.sg.v==-1) {
910 printf("main 7:6 %d yes\n",i);
911 } else {
912 printf("main 7:6 %d no\n",i);
913 }
914 }
915 }
916
917 /* end */