Results 1 to 2 of 2

Thread: QBitArray - find first/last set or clean bit

  1. #1
    Join Date
    Jan 2012
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default QBitArray - find first/last set or clean bit

    How fast do it?
    I must iterate over all bits?
    It will be faster if will possible bits treat at 32 or even 64 bit chunks.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,134
    Thanks
    293
    Thanked 850 Times in 837 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QBitArray - find first/last set or clean bit

    I am sure that the internal implementation of QBitArray::testBit() is optimized for this type of operation. Just iterate over the bits from beginning to end or vice-versa. Anything you try to do to optimize this yourself will probably be slower.

    And as the documentation says:

    For technical reasons, it is more efficient to use testBit() and setBit() to access bits in the array than operator[]().
    It would be better to focus on the important parts of your application rather than trying to rewrite basic Qt classes.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Filling QBitArray with data
    By SpiceWeasel in forum Qt Programming
    Replies: 3
    Last Post: 25th May 2017, 21:52
  2. A problem about "undefined reference to `Clean::Clean(QObject*)'
    By GeorgeDao123 in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 10th February 2013, 09:36
  3. Replies: 6
    Last Post: 9th September 2011, 13:29
  4. Empty QBitArray problem
    By MarkoSan in forum Qt Programming
    Replies: 1
    Last Post: 21st March 2011, 15:06
  5. QBitArray (the smallest unit of them all)
    By baray98 in forum Qt Programming
    Replies: 3
    Last Post: 29th September 2007, 14:16

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.