[issue1205239] Let shift operators take any integer value

2011-08-07 Thread Craig McQueen
Craig McQueen pyt...@craig.mcqueen.id.au added the comment: So this has been rejected I see. Too bad, since I stub my metaphorical toe on this issue from time to time. Just for the record, here is an example: http://stackoverflow.com/questions/4130936/perfect-hash-function/6976723#6976723

[issue1205239] Let shift operators take any integer value

2010-01-26 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Interesting. I agree that that looks like a case where it would be desirable for a -n to do a n. By the way, I don't think your formula is quite correct: your crc is going to grow unboundedly as extra data bytes come in. I suspect that

[issue1205239] Let shift operators take any integer value

2010-01-26 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: One other thought: you could always compute the expression crc (crc_width - 8) as crc 8 crc_width Since you're computing crc 8 anyway, this doesn't increase the operations count, so probably wouldn't significant impact

[issue1205239] Let shift operators take any integer value

2010-01-26 Thread Craig McQueen
Craig McQueen pyt...@craig.mcqueen.id.au added the comment: Thanks, good points. I'm thinking with a C background and the fixed-width data types. The 0xFF could be needed if the data_byte is actually a larger number and you need to ensure only the lowest 8 bits are set. Or, if there is some

[issue1205239] Let shift operators take any integer value

2010-01-26 Thread Craig McQueen
Craig McQueen pyt...@craig.mcqueen.id.au added the comment: To complete that thought... Since crc 8 could bump the calculation into long territory, for that final mask I guess I'd want to mask and then shift. I.e. rather than crc_mask = ((1 crc_width) - 1) crc = (...) ^ ((crc 8)

[issue1205239] Let shift operators take any integer value

2010-01-25 Thread Craig McQueen
Craig McQueen pyt...@craig.mcqueen.id.au added the comment: Just for the record... here is a relevant use case... I'm working on some code for calculating CRCs, and hope to support any CRC width, including CRC-5. This involves, among the calculations: crc (crc_width - 8) The complete

[issue1205239] Let shift operators take any integer value

2009-04-24 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Rejecting this due to: - no activity for almost 4 years - lack of positive responses Also, I'm -1 on this change: for me, a x n that silently becomes x -n when n is negative would cause more harm than good. In most of my uses, left

[issue1205239] Let shift operators take any integer value

2009-01-30 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +marketdickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1205239 ___ ___