Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* LINE COUNT UTILITY
- lc.c 1.00 by FrozenVoid
- licensed under UFIL1.02 http://pastebin.com/L3p9XK3T
- @..\dmc -gg -Nc -Jm -o+all -o-dv %1.c -o%1.exe
- */
- #include "void.h" // http://pastebin.com/L4bT9u1b
- STDSTART
- u4 i;
- if(argc<2){epr("Syntax: lc filename");exit(1);}
- u4 fsize;u1p c=getfile(argv[1],&fsize);
- if(!fsize||!c){epr("File %s cannot be opened or empty",argv[1]);exit(2);};
- u8 exstart=rdtsc();//start of operation
- u4 reg count=1;
- i=fsize;
- wh(i--){count+=(!(c[i]^'\n'));};
- u8 endbench=rdtsc()-exstart;
- pr("%"PRIu32" lines in file %s \n cycles spent:%"PRIu64,count,argv[1],endbench);
- STDEND
Advertisement
Add Comment
Please, Sign In to add comment