#471 Fix setScreenLineCount in ScreenLineManager

closed-fixed
None
5
2013-01-12
2012-12-08
No

Change the bit fiddling of the LSB to use the sign bit of the short type. This leaves one more bit for the line count.

Discussion

  • Thomas Meyer

    Thomas Meyer - 2012-12-12

    New patch attached. Use a char type for the screen line number count. This patch fixes bug 3590540.

     
  • Alan Ezust

    Alan Ezust - 2012-12-28

    I don't understand the documentation comment on line 153 of ScreenLineManager:

    * x == 0 -> invalid entry
    * x >= 0 -> valid entries

    Are you referring to the value of screenLines[x] ? what is x?

     
  • Alan Ezust

    Alan Ezust - 2012-12-28

    I don't understand how you get another bit for anything when you change a short to char.
    I thought short was twice as big as char?

     
  • Thomas Meyer

    Thomas Meyer - 2012-12-28

    1.) "Are you referring to the value of screenLines[x] ? what is x?"

    x is the value of screenLine[lineNumber].

    - when screenLine[lineNumber] == 0 -> this entry is not valid. the physical line needs to be tokenized and the number of screen lines that this physical line will have needs to be calculated.
    - when screenLine[lineNumber] > 0 -> this entry is valid and the number of screen lines for this physical line were already calculated.

    2.) "I thought short was twice as big as char?"

    char and short are both 16 bit wide. char is unsigned and short is signed.

     
  • Alan Ezust

    Alan Ezust - 2012-12-28

    sorry about the short/char confusion. Need more coffee this morning.

     
  • Alan Ezust

    Alan Ezust - 2012-12-28
    • assigned_to: nobody --> thomasmey
    • status: open --> open-accepted
     
  • Alan Ezust

    Alan Ezust - 2012-12-28

    You can commit this directly after a s/x/screenLines[lineNumber]/ in the doc comments as we both discussed.

     
  • Thomas Meyer

    Thomas Meyer - 2013-01-12

    Commited as r22629

     
  • Thomas Meyer

    Thomas Meyer - 2013-01-12
    • status: open-accepted --> open-fixed
     
  • Thomas Meyer

    Thomas Meyer - 2013-01-12
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.