Skip to content

Commit

Permalink
kernel: convert many C comments to C++ comments (gap-system#5271)
Browse files Browse the repository at this point in the history
* kernel: change inline C comment to C++

This commit was generated using this command:

    perl -pi -e 's;/\*[ \t]+(.+[^ \t])[ \t]+\*/[ \t]*$;// \1;g' src/*.* src/hpc/*.*

* kernel: more comment tweaks

- convert more C comments to C++ comments
- remove empty comments
- remove some weird "patterns" at the end of some C++ comments
- fix some indentation issues and other minor stuff in a bunch of comments
- remove some obsolete comments
  • Loading branch information
fingolfin authored Dec 18, 2022
1 parent eef45e1 commit 035f52e
Show file tree
Hide file tree
Showing 97 changed files with 8,588 additions and 8,564 deletions.
153 changes: 73 additions & 80 deletions src/ariths.c

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/bits_intern.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
** known at compile time.
*/

/* constructs a mask that selects bits <from> to <to> inclusive of a UInt */
// constructs a mask that selects bits <from> to <to> inclusive of a UInt
static inline UInt MaskForCopyBits(UInt from, UInt to)
{
return ((to == BIPEB - 1) ? 0 : ((UInt)1 << (to + 1))) - ((UInt)1 << from);
Expand Down Expand Up @@ -76,31 +76,31 @@ static ALWAYS_INLINE void CopyBits(const UInt * fromblock,
* easy
*/
if (frombit == tobit) {
/* if the first and last words are the same word */
// if the first and last words are the same word
if ((frombit + nbits) < BIPEB) {
CopyInWord(toblock, frombit, frombit + nbits - 1, *fromblock, 0);
return;
}
/* do we need to start by copying a partial word */
// do we need to start by copying a partial word
if (frombit) {
CopyInWord(toblock, frombit, BIPEB - 1, *fromblock, 0);
fromblock++;
toblock++;
nbits -= (BIPEB - frombit);
}
/* Now move whole words */
// Now move whole words
if ((wholeblocks = nbits / BIPEB))
memcpy(toblock, fromblock, sizeof(UInt) * wholeblocks);
toblock += wholeblocks;
fromblock += wholeblocks;
nbits %= BIPEB;
/* Finally, we may need to finish with another partial word */
// Finally, we may need to finish with another partial word
if (nbits)
CopyInWord(toblock, 0, nbits - 1, *fromblock, 0);
return;
}

/* Otherwise the bits are not aligned and we will be shifting */
// Otherwise the bits are not aligned and we will be shifting

if (tobit) {
/* How many bits are we going to put into the first destination word
Expand All @@ -109,7 +109,7 @@ static ALWAYS_INLINE void CopyBits(const UInt * fromblock,
tailbits = nbits;
else
tailbits = BIPEB - tobit;
/* We might be able to get all we need from the first source word */
// We might be able to get all we need from the first source word
if (frombit + tailbits <= BIPEB) {
CopyInWord(toblock, frombit, frombit + tailbits - 1, *fromblock,
(tobit - frombit));
Expand All @@ -128,7 +128,7 @@ static ALWAYS_INLINE void CopyBits(const UInt * fromblock,
tobit = 0;
}

/* Main loop for long copies fills whole blocks of destination */
// Main loop for long copies fills whole blocks of destination
UInt m1 = MaskForCopyBits(frombit, BIPEB - 1);
while (nbits >= BIPEB) {
x = (*fromblock++ & m1) >> frombit;
Expand All @@ -137,7 +137,7 @@ static ALWAYS_INLINE void CopyBits(const UInt * fromblock,
nbits -= BIPEB;
}

/* Finally we may need to fill up a partial block at destination */
// Finally we may need to fill up a partial block at destination
if (nbits) {
if (frombit + nbits <= BIPEB) {
CopyInWord(toblock, frombit, frombit + nbits - 1, *fromblock,
Expand Down
Loading

0 comments on commit 035f52e

Please sign in to comment.