Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
c7e3722b
Commit
c7e3722b
authored
Aug 19, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work around GCC bug:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58192
parent
608d7ed7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
45 deletions
+54
-45
layout.c++
c++/src/capnp/layout.c++
+54
-45
No files found.
c++/src/capnp/layout.c++
View file @
c7e3722b
...
@@ -119,60 +119,69 @@ struct WirePointer {
...
@@ -119,60 +119,69 @@ struct WirePointer {
// -----------------------------------------------------------------
// -----------------------------------------------------------------
// Part of pointer that depends on the kind.
// Part of pointer that depends on the kind.
union
{
// Note: Originally StructRef, ListRef, and FarRef were unnamed types, but this somehow
uint32_t
upper32Bits
;
// tickled a bug in GCC:
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58192
struct
StructRef
{
WireValue
<
WordCount16
>
dataSize
;
WireValue
<
WirePointerCount16
>
ptrCount
;
inline
WordCount
wordSize
()
const
{
return
dataSize
.
get
()
+
ptrCount
.
get
()
*
WORDS_PER_POINTER
;
}
struct
{
KJ_ALWAYS_INLINE
(
void
set
(
WordCount
ds
,
WirePointerCount
rc
))
{
WireValue
<
WordCount16
>
dataSize
;
dataSize
.
set
(
ds
);
WireValue
<
WirePointerCount16
>
ptrCount
;
ptrCount
.
set
(
rc
);
}
KJ_ALWAYS_INLINE
(
void
set
(
StructSize
size
))
{
dataSize
.
set
(
size
.
data
);
ptrCount
.
set
(
size
.
pointers
);
}
};
inline
WordCount
wordSize
()
const
{
struct
ListRef
{
return
dataSize
.
get
()
+
ptrCount
.
get
()
*
WORDS_PER_POINTER
;
WireValue
<
uint32_t
>
elementSizeAndCount
;
}
KJ_ALWAYS_INLINE
(
void
set
(
WordCount
ds
,
WirePointerCount
rc
))
{
KJ_ALWAYS_INLINE
(
FieldSize
elementSize
()
const
)
{
dataSize
.
set
(
ds
);
return
static_cast
<
FieldSize
>
(
elementSizeAndCount
.
get
()
&
7
);
ptrCount
.
set
(
rc
);
}
}
KJ_ALWAYS_INLINE
(
ElementCount
elementCount
()
const
)
{
KJ_ALWAYS_INLINE
(
void
set
(
StructSize
size
))
{
return
(
elementSizeAndCount
.
get
()
>>
3
)
*
ELEMENTS
;
dataSize
.
set
(
size
.
data
);
}
ptrCount
.
set
(
size
.
pointers
);
KJ_ALWAYS_INLINE
(
WordCount
inlineCompositeWordCount
()
const
)
{
}
return
elementCount
()
*
(
1
*
WORDS
/
ELEMENTS
);
}
structRef
;
}
// Also covers capabilities.
struct
{
KJ_ALWAYS_INLINE
(
void
set
(
FieldSize
es
,
ElementCount
ec
))
{
WireValue
<
uint32_t
>
elementSizeAndCount
;
KJ_DREQUIRE
(
ec
<
(
1
<<
29
)
*
ELEMENTS
,
"Lists are limited to 2**29 elements."
);
elementSizeAndCount
.
set
(((
ec
/
ELEMENTS
)
<<
3
)
|
static_cast
<
int
>
(
es
));
}
KJ_ALWAYS_INLINE
(
FieldSize
elementSize
()
const
)
{
KJ_ALWAYS_INLINE
(
void
setInlineComposite
(
WordCount
wc
))
{
return
static_cast
<
FieldSize
>
(
elementSizeAndCount
.
get
()
&
7
);
KJ_DREQUIRE
(
wc
<
(
1
<<
29
)
*
WORDS
,
"Inline composite lists are limited to 2**29 words."
);
}
elementSizeAndCount
.
set
(((
wc
/
WORDS
)
<<
3
)
|
KJ_ALWAYS_INLINE
(
ElementCount
elementCount
()
const
)
{
static_cast
<
int
>
(
FieldSize
::
INLINE_COMPOSITE
));
return
(
elementSizeAndCount
.
get
()
>>
3
)
*
ELEMENTS
;
}
}
};
KJ_ALWAYS_INLINE
(
WordCount
inlineCompositeWordCount
()
const
)
{
return
elementCount
()
*
(
1
*
WORDS
/
ELEMENTS
);
}
KJ_ALWAYS_INLINE
(
void
set
(
FieldSize
es
,
ElementCount
ec
))
{
struct
FarRef
{
KJ_DREQUIRE
(
ec
<
(
1
<<
29
)
*
ELEMENTS
,
"Lists are limited to 2**29 elements."
);
WireValue
<
SegmentId
>
segmentId
;
elementSizeAndCount
.
set
(((
ec
/
ELEMENTS
)
<<
3
)
|
static_cast
<
int
>
(
es
));
}
KJ_ALWAYS_INLINE
(
void
setInlineComposite
(
WordCount
wc
))
{
KJ_ALWAYS_INLINE
(
void
set
(
SegmentId
si
))
{
KJ_DREQUIRE
(
wc
<
(
1
<<
29
)
*
WORDS
,
"Inline composite lists are limited to 2**29 words."
);
segmentId
.
set
(
si
);
elementSizeAndCount
.
set
(((
wc
/
WORDS
)
<<
3
)
|
}
static_cast
<
int
>
(
FieldSize
::
INLINE_COMPOSITE
));
};
}
}
listRef
;
struct
{
union
{
WireValue
<
SegmentId
>
segmentId
;
uint32_t
upper32Bits
;
KJ_ALWAYS_INLINE
(
void
set
(
SegmentId
si
))
{
StructRef
structRef
;
segmentId
.
set
(
si
);
// Also covers capabilities.
}
}
farRef
;
ListRef
listRef
;
FarRef
farRef
;
};
};
KJ_ALWAYS_INLINE
(
bool
isNull
()
const
)
{
KJ_ALWAYS_INLINE
(
bool
isNull
()
const
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment