695
673
/* Optimized store functions for Intel x86 */
696
674
#if defined(__i386__)
697
675
#define sint2korr(A) (*((int16 *) (A)))
698
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
699
(((uint32) 255L << 24) | \
700
(((uint32) (uchar) (A)[2]) << 16) |\
701
(((uint32) (uchar) (A)[1]) << 8) | \
702
((uint32) (uchar) (A)[0])) : \
703
(((uint32) (uchar) (A)[2]) << 16) |\
704
(((uint32) (uchar) (A)[1]) << 8) | \
705
((uint32) (uchar) (A)[0])))
676
#define sint3korr(A) ((int32_t) ((((uchar) (A)[2]) & 128) ? \
677
(((uint32_t) 255L << 24) | \
678
(((uint32_t) (uchar) (A)[2]) << 16) |\
679
(((uint32_t) (uchar) (A)[1]) << 8) | \
680
((uint32_t) (uchar) (A)[0])) : \
681
(((uint32_t) (uchar) (A)[2]) << 16) |\
682
(((uint32_t) (uchar) (A)[1]) << 8) | \
683
((uint32_t) (uchar) (A)[0])))
706
684
#define sint4korr(A) (*((long *) (A)))
707
685
#define uint2korr(A) (*((uint16 *) (A)))
708
686
#if defined(HAVE_purify)
709
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
710
(((uint32) ((uchar) (A)[1])) << 8) +\
711
(((uint32) ((uchar) (A)[2])) << 16))
687
#define uint3korr(A) (uint32_t) (((uint32_t) ((uchar) (A)[0])) +\
688
(((uint32_t) ((uchar) (A)[1])) << 8) +\
689
(((uint32_t) ((uchar) (A)[2])) << 16))
719
697
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
720
698
#endif /* HAVE_purify */
721
#define uint4korr(A) (*((uint32 *) (A)))
722
#define uint5korr(A) ((uint64_t)(((uint32) ((uchar) (A)[0])) +\
723
(((uint32) ((uchar) (A)[1])) << 8) +\
724
(((uint32) ((uchar) (A)[2])) << 16) +\
725
(((uint32) ((uchar) (A)[3])) << 24)) +\
699
#define uint4korr(A) (*((uint32_t *) (A)))
700
#define uint5korr(A) ((uint64_t)(((uint32_t) ((uchar) (A)[0])) +\
701
(((uint32_t) ((uchar) (A)[1])) << 8) +\
702
(((uint32_t) ((uchar) (A)[2])) << 16) +\
703
(((uint32_t) ((uchar) (A)[3])) << 24)) +\
726
704
(((uint64_t) ((uchar) (A)[4])) << 32))
727
#define uint6korr(A) ((uint64_t)(((uint32) ((uchar) (A)[0])) + \
728
(((uint32) ((uchar) (A)[1])) << 8) + \
729
(((uint32) ((uchar) (A)[2])) << 16) + \
730
(((uint32) ((uchar) (A)[3])) << 24)) + \
705
#define uint6korr(A) ((uint64_t)(((uint32_t) ((uchar) (A)[0])) + \
706
(((uint32_t) ((uchar) (A)[1])) << 8) + \
707
(((uint32_t) ((uchar) (A)[2])) << 16) + \
708
(((uint32_t) ((uchar) (A)[3])) << 24)) + \
731
709
(((uint64_t) ((uchar) (A)[4])) << 32) + \
732
710
(((uint64_t) ((uchar) (A)[5])) << 40))
733
711
#define uint8korr(A) (*((uint64_t *) (A)))
777
755
#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\
778
756
((int16) ((int16) (A)[1]) << 8))
779
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
780
(((uint32) 255L << 24) | \
781
(((uint32) (uchar) (A)[2]) << 16) |\
782
(((uint32) (uchar) (A)[1]) << 8) | \
783
((uint32) (uchar) (A)[0])) : \
784
(((uint32) (uchar) (A)[2]) << 16) |\
785
(((uint32) (uchar) (A)[1]) << 8) | \
786
((uint32) (uchar) (A)[0])))
787
#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\
788
(((int32) ((uchar) (A)[1]) << 8)) +\
789
(((int32) ((uchar) (A)[2]) << 16)) +\
790
(((int32) ((int16) (A)[3]) << 24)))
757
#define sint3korr(A) ((int32_t) ((((uchar) (A)[2]) & 128) ? \
758
(((uint32_t) 255L << 24) | \
759
(((uint32_t) (uchar) (A)[2]) << 16) |\
760
(((uint32_t) (uchar) (A)[1]) << 8) | \
761
((uint32_t) (uchar) (A)[0])) : \
762
(((uint32_t) (uchar) (A)[2]) << 16) |\
763
(((uint32_t) (uchar) (A)[1]) << 8) | \
764
((uint32_t) (uchar) (A)[0])))
765
#define sint4korr(A) (int32_t) (((int32_t) ((uchar) (A)[0])) +\
766
(((int32_t) ((uchar) (A)[1]) << 8)) +\
767
(((int32_t) ((uchar) (A)[2]) << 16)) +\
768
(((int32_t) ((int16) (A)[3]) << 24)))
791
769
#define sint8korr(A) (int64_t) uint8korr(A)
792
770
#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\
793
771
((uint16) ((uchar) (A)[1]) << 8))
794
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
795
(((uint32) ((uchar) (A)[1])) << 8) +\
796
(((uint32) ((uchar) (A)[2])) << 16))
797
#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
798
(((uint32) ((uchar) (A)[1])) << 8) +\
799
(((uint32) ((uchar) (A)[2])) << 16) +\
800
(((uint32) ((uchar) (A)[3])) << 24))
801
#define uint5korr(A) ((uint64_t)(((uint32) ((uchar) (A)[0])) +\
802
(((uint32) ((uchar) (A)[1])) << 8) +\
803
(((uint32) ((uchar) (A)[2])) << 16) +\
804
(((uint32) ((uchar) (A)[3])) << 24)) +\
772
#define uint3korr(A) (uint32_t) (((uint32_t) ((uchar) (A)[0])) +\
773
(((uint32_t) ((uchar) (A)[1])) << 8) +\
774
(((uint32_t) ((uchar) (A)[2])) << 16))
775
#define uint4korr(A) (uint32_t) (((uint32_t) ((uchar) (A)[0])) +\
776
(((uint32_t) ((uchar) (A)[1])) << 8) +\
777
(((uint32_t) ((uchar) (A)[2])) << 16) +\
778
(((uint32_t) ((uchar) (A)[3])) << 24))
779
#define uint5korr(A) ((uint64_t)(((uint32_t) ((uchar) (A)[0])) +\
780
(((uint32_t) ((uchar) (A)[1])) << 8) +\
781
(((uint32_t) ((uchar) (A)[2])) << 16) +\
782
(((uint32_t) ((uchar) (A)[3])) << 24)) +\
805
783
(((uint64_t) ((uchar) (A)[4])) << 32))
806
#define uint6korr(A) ((uint64_t)(((uint32) ((uchar) (A)[0])) + \
807
(((uint32) ((uchar) (A)[1])) << 8) + \
808
(((uint32) ((uchar) (A)[2])) << 16) + \
809
(((uint32) ((uchar) (A)[3])) << 24)) + \
784
#define uint6korr(A) ((uint64_t)(((uint32_t) ((uchar) (A)[0])) + \
785
(((uint32_t) ((uchar) (A)[1])) << 8) + \
786
(((uint32_t) ((uchar) (A)[2])) << 16) + \
787
(((uint32_t) ((uchar) (A)[3])) << 24)) + \
810
788
(((uint64_t) ((uchar) (A)[4])) << 32) + \
811
789
(((uint64_t) ((uchar) (A)[5])) << 40))
812
#define uint8korr(A) ((uint64_t)(((uint32) ((uchar) (A)[0])) +\
813
(((uint32) ((uchar) (A)[1])) << 8) +\
814
(((uint32) ((uchar) (A)[2])) << 16) +\
815
(((uint32) ((uchar) (A)[3])) << 24)) +\
816
(((uint64_t) (((uint32) ((uchar) (A)[4])) +\
817
(((uint32) ((uchar) (A)[5])) << 8) +\
818
(((uint32) ((uchar) (A)[6])) << 16) +\
819
(((uint32) ((uchar) (A)[7])) << 24))) <<\
790
#define uint8korr(A) ((uint64_t)(((uint32_t) ((uchar) (A)[0])) +\
791
(((uint32_t) ((uchar) (A)[1])) << 8) +\
792
(((uint32_t) ((uchar) (A)[2])) << 16) +\
793
(((uint32_t) ((uchar) (A)[3])) << 24)) +\
794
(((uint64_t) (((uint32_t) ((uchar) (A)[4])) +\
795
(((uint32_t) ((uchar) (A)[5])) << 8) +\
796
(((uint32_t) ((uchar) (A)[6])) << 16) +\
797
(((uint32_t) ((uchar) (A)[7])) << 24))) <<\
821
799
#define int2store(T,A) do { uint def_temp= (uint) (A) ;\
822
800
*((uchar*) (T))= (uchar)(def_temp); \
930
908
((uint16) ((uint16) (M)[0]) << 8)); } while(0)
931
909
#define shortget(V,M) do { V = (short) (((short) ((uchar) (M)[1]))+\
932
910
((short) ((short) (M)[0]) << 8)); } while(0)
933
#define longget(V,M) do { int32 def_temp;\
911
#define longget(V,M) do { int32_t def_temp;\
934
912
((uchar*) &def_temp)[0]=(M)[0];\
935
913
((uchar*) &def_temp)[1]=(M)[1];\
936
914
((uchar*) &def_temp)[2]=(M)[2];\
937
915
((uchar*) &def_temp)[3]=(M)[3];\
938
916
(V)=def_temp; } while(0)
939
#define ulongget(V,M) do { uint32 def_temp;\
917
#define ulongget(V,M) do { uint32_t def_temp;\
940
918
((uchar*) &def_temp)[0]=(M)[0];\
941
919
((uchar*) &def_temp)[1]=(M)[1];\
942
920
((uchar*) &def_temp)[2]=(M)[2];\