how to fast perform faster i/o for negative integers

Can any one tell how perform input of negative numbers fastly.

I think following will helpful.

Fast i/o for c/c++

#define GC getchar_unlocked
#define PC putchar_unlocked
	
inline int ri()
{
    int n=0,a=1;
    char c=GC();
    
    while(c < 48 || c >57) 
	{
		if(c=='-')
		{
			a=-1;
		}
		c=GC();
	}
    while(c>47 && c<58)
    {
   		n=(n<<3)+(n<<1)+c-'0';
    	c=GC();
    }
    return a*n;
}

inline void fastwrite(int a)
{
	if(a<0)
	{	
		PC('-');
		a=-a;
	}
	
	char snum[20];
	int i=0;
	do
	{
		snum[i++]=a%10+48;
		a=a/10;
	}while(a!=0);
	
	i=i-1;
	
	while(i>=0)
		PC(snum[i--]);
	PC('\n');
}