33 lines
1.0 KiB
Markdown
33 lines
1.0 KiB
Markdown
---
|
|
title: "Remember that integer range checks can always be done with only one comparison: (unsigned) (x - min) <= (unsigned) (max - min)"
|
|
type: archive
|
|
source: twitter
|
|
source_url: "https://x.com/EricLengyel/status/546120250450653184"
|
|
author: "Eric Lengyel"
|
|
handle: EricLengyel
|
|
post_id: "546120250450653184"
|
|
date: 2014-12-20
|
|
archived: 2026-08-27
|
|
draft: false
|
|
tags:
|
|
- archive
|
|
- twitter
|
|
- EricLengyel
|
|
description: "Remember that integer range checks can always be done with only one comparison: (unsigned) (x - min) <= (unsigned) (max - min)"
|
|
in_reply_to: ""
|
|
---
|
|
|
|
## Source
|
|
|
|
- URL: https://x.com/EricLengyel/status/546120250450653184
|
|
- Author: Eric Lengyel (@EricLengyel)
|
|
- Posted: 2014-12-20 01:49:48
|
|
|
|
## Thread
|
|
|
|
**1/** **@EricLengyel** ^546120250450653184
|
|
|
|
Remember that integer range checks can always be done with only one comparison: (unsigned) (x - min) <= (unsigned) (max - min)
|
|
|
|
Branches: [[archive/threads/EricLengyel/2014-12-20-remember-that-integer-range-checks-can-always-be/2014-12-20-fanf-gives-me-the-heebie-jeebies-since-overflow-is]]
|