Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. #include "types.h"
  2.  
  3. void err_hex(UInt32 val){
  4.  
  5.         char x[9];
  6.         unsigned char i, c;
  7.        
  8.         x[8] = 0;
  9.        
  10.         for(i = 0; i < 8; i++){
  11.                
  12.                 c = val & 0x0F;
  13.                 val >>= 4;
  14.                 c = (c >= 10) ? (c + 'A' - 10) : (c + '0');
  15.                 x[7 - i] = c;  
  16.         }
  17.        
  18.         err_str(x);
  19. }
  20.  
  21. void err_dec(UInt32 val){
  22.        
  23.         char x[16];
  24.         unsigned char i, c;
  25.        
  26.         x[sizeof(x) - 1] = 0;
  27.        
  28.         for(i = 0; i < sizeof(x) - 1; i++){
  29.                
  30.                 c = (val % 10) + '0';
  31.                 val /= 10;
  32.                 x[sizeof(x) - 2 - i] = c;      
  33.                 if(!val) break;
  34.         }
  35.         err_str(x + sizeof(x) - 2 - i);
  36. }
  37.  
  38. void __mem_zero(void* ptr, UInt16 sz){
  39.        
  40.         UInt8* p = ptr;
  41.        
  42.         while(sz--) *p++ = 0;  
  43. }
  44.  
  45. void __mem_copy(void* d_, const void* s_, UInt32 sz){
  46.        
  47.         UInt8* d = d_;
  48.         const UInt8* s = s_;
  49.        
  50.         while(sz--) *d++ = *s++;
  51. }