Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
ebbfc660
Commit
ebbfc660
authored
Apr 26, 2011
by
Thomas Jahns
🤸
Browse files
Fix confusion of idx and code in previous commit.
parent
a0bcc75c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/namespace.c
View file @
ebbfc660
...
...
@@ -11,14 +11,14 @@ static int activeNamespace;
enum
{
intbits
=
sizeof
(
int
)
*
CHAR_BIT
,
nspbits
=
4
,
code
bits
=
intbits
-
nspbits
,
nspmask
=
((
1
<<
nspbits
)
-
1
)
<<
code
bits
,
code
mask
=
(
1
<<
code
bits
)
-
1
,
idx
bits
=
intbits
-
nspbits
,
nspmask
=
((
1
<<
nspbits
)
-
1
)
<<
idx
bits
,
idx
mask
=
(
1
<<
idx
bits
)
-
1
,
};
enum
{
NUM_NAMESPACES
=
1
<<
nspbits
,
NUM_
CODES
=
1
<<
code
bits
,
NUM_
IDX
=
1
<<
idx
bits
,
};
...
...
@@ -41,8 +41,8 @@ void namespaceShowbits ( int n, char *name )
int
namespaceIdxEncode
(
namespaceTuple_t
tin
)
{
assert
(
tin
.
nsp
<
NUM_NAMESPACES
&&
tin
.
idx
<
NUM_
CODES
);
return
(
tin
.
nsp
<<
code
bits
)
+
tin
.
idx
;
assert
(
tin
.
nsp
<
NUM_NAMESPACES
&&
tin
.
idx
<
NUM_
IDX
);
return
(
tin
.
nsp
<<
idx
bits
)
+
tin
.
idx
;
}
...
...
@@ -50,8 +50,8 @@ namespaceTuple_t namespaceIdxDecode ( int code )
{
namespaceTuple_t
tin
;
tin
.
idx
=
code
&
code
mask
;
tin
.
nsp
=
(
int
)(((
unsigned
)(
code
&
nspmask
))
>>
code
bits
);
tin
.
idx
=
code
&
idx
mask
;
tin
.
nsp
=
(
int
)(((
unsigned
)(
code
&
nspmask
))
>>
idx
bits
);
return
tin
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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