URL
https://opencores.org/ocsvn/mips789/mips789/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 15 |
Rev 35 |
Line 1... |
Line 1... |
|
/******************************************************************
|
|
* *
|
|
* Author: Liwei *
|
|
* *
|
|
* This file is part of the "mips789" project. *
|
|
* Downloaded from: *
|
|
* http://www.opencores.org/pdownloads.cgi/list/mips789 *
|
|
* *
|
|
* If you encountered any problem, please contact me via *
|
|
* Email:mcupro@opencores.org or mcupro@163.com *
|
|
* *
|
|
******************************************************************/
|
|
|
#include "stdio.h"
|
#include "stdio.h"
|
#include "stdlib.h"
|
#include "stdlib.h"
|
#define DEFAULT_LEN "2048"
|
#define DEFAULT_LEN "2048"
|
/*Liwei 2007-8-29*/
|
/*Liwei 2007-8-29*/
|
char HEX[]="0123456789ABCDEF" ;
|
char HEX[]="0123456789ABCDEF" ;
|
Line 16... |
Line 29... |
unsigned int i,ret=0 ;
|
unsigned int i,ret=0 ;
|
if(par==NULL)return ;
|
if(par==NULL)return ;
|
if((0==strncmp(par,"0x",2))||(0==strncmp(par,"0X",2)))
|
if((0==strncmp(par,"0x",2))||(0==strncmp(par,"0X",2)))
|
for(i=2;;++i)
|
for(i=2;;++i)
|
{
|
{
|
if(par[i]=='\0')return ret ;
|
if(par[i]=='\0')return ret ;if(par[i]==' ')return ret ;
|
ret=ret*16+hex2byte(par[i]);
|
ret=ret*16+hex2byte(par[i]);
|
}
|
}
|
else
|
else
|
for(i=0;;++i)
|
for(i=0;;++i)
|
{
|
{
|
if(par[i]=='\0')return ret ;
|
if(par[i]=='\0')return ret ;if(par[i]==' ')return ret ;
|
ret=ret*10+hex2byte(par[i]);
|
ret=ret*10+hex2byte(par[i]);
|
}
|
}
|
return 0 ;
|
return 0 ;
|
}
|
}
|
/****************************/
|
/****************************/
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.