1 #include "ace/Basic_Types.h"
3 #if !defined (__ACE_INLINE__)
4 # include "ace/Basic_Types.inl"
5 #endif /* ! __ACE_INLINE__ */
10 "$Id: Basic_Types.cpp 80826 2008-03-04 14:51:23Z wotte $")
13 #if defined (ACE_LACKS_LONGLONG_T) && !defined (ACE_LACKS_UNSIGNEDLONGLONG_T)
14 # include "ace/Log_Msg.h"
15 # include "ace/OS_NS_stdio.h"
16 # include "ace/OS_NS_string.h"
17 # if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
18 // FUZZ: disable check_for_streams_include
19 # include "ace/streams.h"
20 # endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
25 ACE_U_LongLong::output (FILE *file
) const
28 ACE_OS::fprintf (file
, "0x%lx%0*lx", h_ (), 2 * sizeof l_ (), l_ ());
30 ACE_OS::fprintf (file
, "0x%lx", l_ ());
35 ACE_U_LongLong::as_string (ACE_TCHAR
*output
,
37 unsigned int uppercase
) const
41 ACE_OS::strcpy(output
, "0");
49 unsigned int index
= 0;
53 unsigned int sval
= (this->h_ () >> bshift
) & 7;
54 if (sval
> 0 || index
!= 0)
56 output
[index
] = sval
+ '0';
64 unsigned int sval
= (this->l_ () >> bshift
) & 7;
65 // Combine the last bit of hi with the first 3-bit digit
68 sval
|= (this->h_ () & 1) << 2;
70 if (sval
> 0 || index
!= 0)
72 output
[index
] = sval
+ '0';
82 ACE_OS::sprintf(output
, "%.0f", *this / 1.0);
89 ACE_OS::sprintf(output
,
90 (uppercase
? "%lX%0*lX" : "%lx%0*lx"),
91 this->h_ (), 2 * sizeof this->l_ (),
96 ACE_OS::sprintf(output
,
97 (uppercase
? "%lX" : "%lx"), this->l_ ());
104 ACE_DEBUG ((LM_DEBUG
,
105 ACE_TEXT ("Unsupported base = %u\n"), base
));
115 # if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
117 operator<< (ostream
& os
, const ACE_U_LongLong
& ll
)
119 #ifdef __TANDEM && (__CPLUSPLUS_VERSION >= 3)
120 unsigned long flags
= os
.flags();
122 unsigned long flags
= os
.setf(0);
126 if ((flags
& ios::oct
) != 0)
127 os
<< ll
.as_string (buffer
, 8);
128 else if ((flags
& ios::hex
) != 0)
129 os
<< ll
.as_string (buffer
, 16, (flags
& ios::uppercase
));
131 os
<< ll
.as_string (buffer
);
136 ACE_END_VERSIONED_NAMESPACE_DECL
138 #endif /* ACE_LACKS_LONGLONG_T */