/*==========================================================================
 *                                                                         *
 *  Copyright (C) 2001 Dymchenko L.A.                                      *
 *                                                                         *
 *  VirtualRay (Spherical Engine) additional header file                   *
 *                                                                         *
 ***************************************************************************/


#ifndef Service_h
#define Service_h


#include "Types@.h"


void starttiming();
i32 endtiming();


inline i16  rnumtomm16(rnumt v)
{
  return (i16)(v*8191);
}

inline mm32 rnumtomm32(rnumt v)
{
  mm32 mm;

  mm.w.w0=(i16)(v*8191);
  mm.w.w1=mm.w.w0;

  return mm;
}


inline i32 quard(i32 num)
{
    return ((num-1)>>2);
}

inline i32 divup(i32 dividend, i32 divisor)
{
    return ((dividend+divisor-1)/divisor);
}


void  getphipsi(rnumt& phi, rnumt& psi, rvectort v);


rnumt random();
rnumt random(rnumt lo, rnumt hi);
i32 random(i32 lo, i32 hi);
void initrandom();


void* alignpointer(void* p, i32 align);


void randomcolor(bcolor4t col);
void randomcolor(bytecolor3t col);
void brightrandomcolor(bcolor4t col);


#endif





