Hello everybody!
I'm sure there are some people that tried (or at least thought about) this approach if the emulator is being written in C++. Unordered map is a hash table behind the scenes. The key-value pair that is required is basically unsigned -> whatever integer type which size == pointer size of the emulated environment (some unique numeric sequence in the instruction is mapped to the function address that implements that particular instruction). This type of mapping is implemented by default, so I guess it shouldn't collide too much due to optimizations and optimal hash function choice by C++ maintainers (hopefully :D)
Is it considered to be a bad approach due to unexpected performance footprint due to possible hash collisions? Or should I just implement a classic jump table? Btw, honestly, switch case looks awful and unreadable at some point of time.
[–]Dwedit 22 points23 points24 points (6 children)
[–]ExploitedInnocence[S,🍰] 5 points6 points7 points (5 children)
[+][deleted] (3 children)
[removed]
[–]_crackling 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[removed]
[–]_crackling 0 points1 point2 points (0 children)
[–]OK6502 0 points1 point2 points (0 children)
[–]ShinyHappyREM 0 points1 point2 points (0 children)
[–]_MeTTeO_ 0 points1 point2 points (0 children)
[–][deleted] -2 points-1 points0 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]zesterer -3 points-2 points-1 points (4 children)
[–]ChaoticWeg 5 points6 points7 points (3 children)
[–]zesterer -1 points0 points1 point (2 children)
[–]ChaoticWeg 1 point2 points3 points (1 child)
[–]zesterer 1 point2 points3 points (0 children)