Merge lp:~paul-lucas/zorba/bug-1075106 into lp:zorba

Proposed by Paul J. Lucas on 2012-11-09
Status: Merged
Approved by: Paul J. Lucas on 2012-11-09
Approved revision: 11128
Merged at revision: 11126
Proposed branch: lp:~paul-lucas/zorba/bug-1075106
Merge into: lp:zorba
Diff against target: 58 lines (+20/-4)
2 files modified
src/zorbatypes/integer.cpp (+8/-0)
src/zorbatypes/integer.h (+12/-4)
To merge this branch: bzr merge lp:~paul-lucas/zorba/bug-1075106
Reviewer Review Type Date Requested Status
Matthias Brantner Needs Fixing on 2012-11-09
David Graf (community) 2012-11-09 Approve on 2012-11-09
Paul J. Lucas Approve on 2012-11-09
Review via email: mp+133612@code.launchpad.net

Commit message

Fixed sign extension.

Description of the change

Fixed sign extension.

To post a comment you must log in.
Paul J. Lucas (paul-lucas) :
review: Approve
David Graf (davidagraf) :
review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1075106-2012-11-09T14-28-50.881Z is finished. The final status was:

All tests succeeded!

ChangeLog entry is missing.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/zorbatypes/integer.cpp'
2--- src/zorbatypes/integer.cpp 2012-09-19 21:16:15 +0000
3+++ src/zorbatypes/integer.cpp 2012-11-09 03:22:22 +0000
4@@ -77,6 +77,14 @@
5 value_ = ztd::itoa( n, buf );
6 }
7
8+#if ZORBA_SIZEOF_INT == ZORBA_SIZEOF_LONG
9+TEMPLATE_DECL(T)
10+INTEGER_IMPL(T)::IntegerImpl( unsigned int n ) {
11+ ztd::itoa_buf_type buf;
12+ value_ = ztd::itoa( n, buf );
13+}
14+#endif /* ZORBA_SIZEOF_INT == ZORBA_SIZEOF_LONG */
15+
16 IntegerImpl::IntegerImpl( unsigned long n ) {
17 ztd::itoa_buf_type buf;
18 value_ = ztd::itoa( n, buf );
19
20=== modified file 'src/zorbatypes/integer.h'
21--- src/zorbatypes/integer.h 2012-10-30 21:26:12 +0000
22+++ src/zorbatypes/integer.h 2012-11-09 03:22:22 +0000
23@@ -578,23 +578,31 @@
24
25 TEMPLATE_DECL(I)
26 inline INTEGER_IMPL(I)::IntegerImpl( unsigned char c ) :
27- value_( static_cast<long>( c ) )
28+ value_( static_cast<long>( (unsigned long)c ) )
29 {
30 }
31
32 TEMPLATE_DECL(I)
33 inline INTEGER_IMPL(I)::IntegerImpl( unsigned short n ) :
34- value_( static_cast<long>( n ) )
35+ value_( static_cast<long>( (unsigned long)n ) )
36 {
37 }
38
39+#ifdef ZORBA_WITH_BIG_INTEGER
40+#if ZORBA_SIZEOF_INT != ZORBA_SIZEOF_LONG
41+TEMPLATE_DECL(T)
42+inline INTEGER_IMPL(T)::IntegerImpl( unsigned int n ) :
43+ value_( static_cast<long>( (unsigned long)n ) )
44+{
45+}
46+#endif /* ZORBA_SIZEOF_INT == ZORBA_SIZEOF_LONG */
47+#else /* ZORBA_WITH_BIG_INTEGER */
48 TEMPLATE_DECL(I)
49 inline INTEGER_IMPL(I)::IntegerImpl( unsigned int n ) :
50- value_( static_cast<long>( n ) )
51+ value_( static_cast<value_type>( n ) )
52 {
53 }
54
55-#ifndef ZORBA_WITH_BIG_INTEGER
56 TEMPLATE_DECL(I)
57 inline INTEGER_IMPL(I)::IntegerImpl( unsigned long n ) :
58 value_( static_cast<value_type>( n ) )

Subscribers

People subscribed via source and target branches