• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa and bit handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa and bit handling


  • Subject: Re: Cocoa and bit handling
  • From: Stephane Sudre <email@hidden>
  • Date: Tue, 21 Dec 2004 14:57:09 +0100


On 21 déc. 04, at 12:27, Peter Karlsson wrote:

Dear list!

I have 2 pointers declared as byte. They are called source and target.

The source pointer points to the first byte of a memory area. The target
pointer points to the first byte of another memory area.


Is there a easy way to move bits fom source byte to target byte?

Example:

Source byte maybe looks like this:
01001011

Target byte looks like this before:
00000000

Target byte looks like this after:
01000000

I want to move bit 3 of the source byte to bit 6 of the target byte. This
will repeat thousands of times in a loop. And the bit position changes
every lap. So next lap I maybe want to move source bit 2 to target bit 5
and so on...

maskSource=(1<<bitSource);

maskDestination==(1<<bitDestination);

target= (target & ~ maskDestination) + (((source & maskSource)>> bitSource)<< bitDestination);

probably

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Cocoa and bit handling (From: "Peter Karlsson" <email@hidden>)

  • Prev by Date: Fwd: Cocoa and bit handling
  • Next by Date: RE: Re: Midisport and sysex
  • Previous by thread: Cocoa and bit handling
  • Next by thread: Re: Cocoa and bit handling
  • Index(es):
    • Date
    • Thread