source: to-imperative/trunk/runtime/rf_short_int.ih @ 838

Last change on this file since 838 was 838, checked in by pooh, 18 years ago
  • Expr::write() rewriting. StdIO::WriteLN() added.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 595 bytes
Line 
1// $Source$
2// $Revision: 838 $
3// $Date: 2003-06-10 09:05:41 +0000 (Tue, 10 Jun 2003) $
4// $Author: pooh $
5
6#ifndef __rf_short_int_ih__
7#define __rf_short_int_ih__
8
9#include "rf_short_int.hh"
10#include "rf_term.ih"
11
12namespace rftype
13{
14
15using namespace rfrt;
16
17inline ShortInt::ShortInt(intptr_t _n) :
18  Term(type_short_int)
19{
20  int_data2 = _n;
21}
22
23inline intptr_t ShortInt::to_int() const
24{
25  return int_data2;
26}
27
28inline size_t ShortInt::get_char_len() const
29{
30  intptr_t n = int_data2;
31  uintptr_t k = 0;
32  if (!n) k = 1;
33  else {
34    if (n < 0) k++;
35    while (n) {
36      n /= 10;
37      k++;
38    };
39  };
40  return k;
41};
42
43}
44
45#endif // __rf_short_int_ih__
Note: See TracBrowser for help on using the repository browser.