Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
83e293a6
Commit
83e293a6
authored
Jul 21, 2010
by
Dean Camera
Browse files
Replace internal Pipe_BytesToEPSizeMask() routine with a new version which results in smaller code.
parent
97143bf8
Changes
1
Hide whitespace changes
Inline
Side-by-side
LUFA/Drivers/USB/LowLevel/Pipe.h
View file @
83e293a6
...
...
@@ -1061,18 +1061,16 @@
static
inline
uint8_t
Pipe_BytesToEPSizeMask
(
const
uint16_t
Bytes
)
ATTR_WARN_UNUSED_RESULT
ATTR_CONST
ATTR_ALWAYS_INLINE
;
static
inline
uint8_t
Pipe_BytesToEPSizeMask
(
const
uint16_t
Bytes
)
{
if
(
Bytes
<=
8
)
return
(
0
<<
EPSIZE0
);
else
if
(
Bytes
<=
16
)
return
(
1
<<
EPSIZE0
);
else
if
(
Bytes
<=
32
)
return
(
2
<<
EPSIZE0
);
else
if
(
Bytes
<=
64
)
return
(
3
<<
EPSIZE0
);
else
if
(
Bytes
<=
128
)
return
(
4
<<
EPSIZE0
);
else
return
(
5
<<
EPSIZE0
);
uint8_t
MaskVal
=
0
;
uint16_t
CheckBytes
=
8
;
while
((
CheckBytes
<
Bytes
)
&&
(
CheckBytes
<
PIPE_MAX_SIZE
))
{
MaskVal
++
;
CheckBytes
<<=
1
;
}
return
(
MaskVal
<<
EPSIZE0
);
}
#endif
...
...
Write
Preview
Supports
Markdown
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