On Jan 22, S. Dale Morrey wrote:
> For instance in many places, Origin has...
> pstart->nVersion
>
> but fork1 has
> pstart->nVersion&0xff
This is a bitwise AND, using 0xFF as a mask to clear every bit except
for the least significant byte. Perhaps importantly, it clears the sign
bit, so >= comparisons might treat it as unsigned. Maybe. That
behavior might even depend on the compiler.
For the name nVersion in particular, it might be the case that each
number in the version tuple is encoded in a different byte of the
nVersion number, but that usually has the patch level in the least
significant byte.
> For the life of me I just can't understand what fork1 is doing with that
> line of code. It's possible that this code was present in the origin code
> base and only modified later, frankly I'm not sure how I would go about
> checking.
Unfortunately, with this level of detail, we don't know either.
What I can explain, however, are a pair of git tools that might help.
My first thought, having come from a Subversion background, is the
`git blame` command, which tells you which commit last changed each line
in a given file. However, its man page points to a more appropriate
tool for this case: the -S parameter to the `git log` command.
For example:
git log --oneline -S'nVersion&0xff' origin fork1 fork2 --
will show all commits that add or remove that string, in all three
branches. My suspicion is that running it on just the origin branch
will either show nothing, or have the commit that removed them all right
at the top; in the former case, it was added in the forks, and you'll
probably sift through several false positives before hitting the commit
you want.
If you're lucky, the commit author will have left an explanation in the
commit message. If you're very lucky, it will have a test case that
would have failed without the change. Otherwise, you can try running
the program before and after that commit, to see how it changes things.
- Eric
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/