MCPcopy Create free account
hub / github.com/Sinflower/UberWolf / GetCharCode_inline

Function GetCharCode_inline

3rdParty/DXLib/CharCode.cpp:792–939  ·  view source on GitHub ↗

1文字の文字コードと文字のバイト数を取得する

Source from the content-addressed store, hash-verified

790
791// 1文字の文字コードと文字のバイト数を取得する
792__inline u32 GetCharCode_inline( const char *CharCode, int CharCodeFormat, int *CharBytes )
793{
794 int UseSrcSize ;
795 u32 DestCode ;
796
797 switch( GetCharCodeFormatUnitSize_inline( CharCodeFormat ) )
798 {
799 case 1 :
800 if( ( ( u8 * )CharCode )[ 0 ] == 0 )
801 {
802 if( CharBytes != NULL )
803 {
804 *CharBytes = 1 ;
805 }
806 return 0 ;
807 }
808 break ;
809
810 case 2 :
811 if( *( ( u16 * )CharCode ) == 0 )
812 {
813 if( CharBytes != NULL )
814 {
815 *CharBytes = 2 ;
816 }
817 return 0 ;
818 }
819 break ;
820
821 case 4 :
822 if( *( ( u32 * )CharCode ) == 0 )
823 {
824 if( CharBytes != NULL )
825 {
826 *CharBytes = 4 ;
827 }
828 return 0 ;
829 }
830 break ;
831 }
832
833 UseSrcSize = GetCharBytes_inline( CharCode, CharCodeFormat ) ;
834
835 switch( CharCodeFormat )
836 {
837 case CHARCODEFORMAT_SHIFTJIS :
838 case CHARCODEFORMAT_GB2312 :
839 case CHARCODEFORMAT_UHC :
840 case CHARCODEFORMAT_BIG5 :
841 if( UseSrcSize == 2 )
842 {
843 DestCode = ( ( ( u8 * )CharCode )[ 0 ] << 8 ) | ( ( u8 * )CharCode )[ 1 ] ;
844 }
845 else
846 {
847 DestCode = ( ( u8 * )CharCode )[ 0 ] ;
848 }
849 break ;

Callers 10

GetCharCodeFunction · 0.85
ConvStringFunction · 0.85
GetStringCharNumFunction · 0.85
GetStringCharAddressFunction · 0.85
GetStringCharCodeFunction · 0.85
CL_stricmpFunction · 0.85
CL_strchrFunction · 0.85
CL_strrchrFunction · 0.85
CL_struprFunction · 0.85

Calls 2

GetCharBytes_inlineFunction · 0.85

Tested by

no test coverage detected