❌

Normale weergave

Steinar H. Gunderson: Decompilation patterns part 9, sign extension

12 Oktober 2026 om 22:15

Today, for something completely different:

s.x = (s16) ((s32) (temp_v0 << 0x10) >> 0x11);

MIPS has 16-bit loads and stores, but not 16-bit (signed) arithmetic, so if it wants to do that, it needs to sign-extend to 32-bit first. And it does that by first shifting up by 16 so that the 16-bit sign bit is at the 32-bit sign bit, and then it can do an arithmetic shift afterwards. So what you want is:

s16 temp_v0;

s.x = temp_v0 >> 1;

Sometimes, it can be pretty stubborn, and you'll need to go through memory or similar before GCC really inserts the shift patterns you want.

  •  

Maytham Alsudany: There's more to CSS for underlining

12 Oktober 2026 om 14:09

I read Ruben Schade's notes on underlining and wanted to add more, as adding a border-bottom and leaving at that seemed incomplete to me.

Modern

Of course, you could just use the modern choice. Here, I've shortened what Schade uses into one line of CSS (because I can). As noted, this is a fairly new feature so not every browser supports this.

[This interactive/preview is only available on the website.]
.underline-me {
	text-decoration: underline red solid 3px;
}

Workarounds

Since some browsers don't support text-decoration, here are the alternatives I could think of.

border-bottom

The workaround Schade describes is using border-bottom, though it has a gap between the text in the line.

[This interactive/preview is only available on the website.]
I am <span class="underline-me">underlining this yap</span> within the sentence.
.underline-me {
	border-bottom: red solid 3px;
}

::after

Probably the better way is to create an ::after element, which gets very close, but displays above the text (covering the letters 'g' and 'y').

[This interactive/preview is only available on the website.]
I am <span class="underline-me">underlining this yap</span> within the sentence.
.underline-me {
	position: relative;
}
.underline-me::after {
	content: '';
	position: absolute;
	width: 100%;
	height: 3px;
	background-color: red;
	left: 0;
	bottom: 2px;
}

::after in a container

If you use a container (in this case, two nested <span>s instead of just one), then you can get very close with the underline displaying below the text.

[This interactive/preview is only available on the website.]
I am
<span class="underline-me-ctn">
	<span class="underline-me">underlining this yap</span>
</span>
within the sentence.
.underline-me-ctn {
	position: relative;
}
.underline-me {
	z-index: 10;
	position: relative;
}
.underline-me-ctn::after {
	content: '';
	position: absolute;
	width: 100%;
	height: 3px;
	background-color: red;
	left: 0;
	bottom: 2px;
}

::after in a container with text stroke

And now if you add a stroke to the text via -webkit-text-stroke, you're pretty much there, though this may not be feasible in some situations (e.g. gradient or image background behind the text). Support for -webkit-text-stroke is not that much better than text-decoration though, so make of that what you will.

[This interactive/preview is only available on the website.]
I am
<span class="underline-me-ctn">
	<span class="underline-me-outline">underlining this yap</span>
	<span class="underline-me">underlining this yap</span>
</span>
within the sentence.
.underline-me-ctn {
	position: relative;
}
.underline-me-outline {
	z-index: 5;
	position: absolute;
	left: 0;
	color: var(--background);
	-webkit-text-stroke: 0.3em var(--background);
}
.underline-me {
	z-index: 10;
	position: relative;
}
.underline-me-ctn::after {
	content: '';
	position: absolute;
	width: 100%;
	height: 3px;
	background-color: red;
	left: 0;
	bottom: 2px;
}
  •  
❌