Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libMiMic by
NyLPC_mimicvm_utils.c
00001 #include "NyLPC_mimicvm_utils_protected.h" 00002 /** 00003 * i_txtを16進数に変換する。 00004 * @param i_txt 00005 * テキスト形式の16進数。[a-f0-9]+であること 00006 * @param i_num 00007 * i_txtの長さ。2,4,8のいずれかであること。 00008 * @param out 00009 * 出力値を格納するメモリアドレス。 00010 * i_numにより、必要なサイズが変化する。 00011 * 00012 */ 00013 NyLPC_TBool NyLPC_mimicvm_txt2UInt(const NyLPC_TChar* i_txt,NyLPC_TUInt8 i_num,void* out) 00014 { 00015 NyLPC_TUInt32 ret=0; 00016 NyLPC_TChar c; 00017 int i; 00018 00019 for(i=0;i<i_num;i++){ 00020 c=(*(i_txt+i)); 00021 if('f'>=c && c>='a'){ 00022 c=c-(NyLPC_TUInt8)'a'+10; 00023 }else if('9'>=c && c>='0'){ 00024 c-=(NyLPC_TUInt8)'0'; 00025 }else{ 00026 return NyLPC_TBool_FALSE; 00027 } 00028 ret=(ret<<4)|c; 00029 } 00030 //2,4,8だけ。 00031 switch(i_num){ 00032 case 2: 00033 *((NyLPC_TUInt8*)out)=(NyLPC_TUInt8)ret; 00034 break; 00035 case 4: 00036 *((NyLPC_TUInt16*)out)=(NyLPC_TUInt16)ret; 00037 break; 00038 case 8: 00039 *((NyLPC_TUInt32*)out)=(NyLPC_TUInt32)ret; 00040 break; 00041 default: 00042 return NyLPC_TBool_FALSE; 00043 } 00044 return NyLPC_TBool_TRUE; 00045 } 00046
Generated on Tue Jul 12 2022 16:22:59 by
1.7.2
