Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / Util / SimpleBitVector32.cs / 1 / SimpleBitVector32.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Util { using System; // // This is a cut down copy of System.Collections.Specialized.BitVector32. The // reason this is here is because it is used rather intensively by Control and // WebControl. As a result, being able to inline this operations results in a // measurable performance gain, at the expense of some maintainability. // [Serializable] internal struct SimpleBitVector32 { private int data; internal SimpleBitVector32(int data) { this.data = data; } internal int IntegerValue { get { return data; } set { data = value; } } internal bool this[int bit] { get { return (data & bit) == bit; } set { int _data = data; if(value) { data = _data | bit; } else { data = _data & ~bit; } } } internal void Set(int bit) { data |= bit; } internal void Clear(int bit) { data &= ~bit; } #if UNUSED_CODE internal void Toggle(int bit) { data ^= bit; } /* * COPY_FLAG copies the value of flags from a source field * into a destination field. * * In the macro: * + "&flag" limits the outer xor operation to just the flag we're interested in. * + These are the results of the two xor operations: * * fieldDst fieldSrc inner xor outer xor * 0 0 0 0 * 0 1 1 1 * 1 0 1 0 * 1 1 0 1 */ internal void Copy(SimpleBitVector32 src, int bit) { data ^= (data ^ src.data) & bit; } internal int Data { get { return data; } set { data = value; } } #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Util { using System; // // This is a cut down copy of System.Collections.Specialized.BitVector32. The // reason this is here is because it is used rather intensively by Control and // WebControl. As a result, being able to inline this operations results in a // measurable performance gain, at the expense of some maintainability. // [Serializable] internal struct SimpleBitVector32 { private int data; internal SimpleBitVector32(int data) { this.data = data; } internal int IntegerValue { get { return data; } set { data = value; } } internal bool this[int bit] { get { return (data & bit) == bit; } set { int _data = data; if(value) { data = _data | bit; } else { data = _data & ~bit; } } } internal void Set(int bit) { data |= bit; } internal void Clear(int bit) { data &= ~bit; } #if UNUSED_CODE internal void Toggle(int bit) { data ^= bit; } /* * COPY_FLAG copies the value of flags from a source field * into a destination field. * * In the macro: * + "&flag" limits the outer xor operation to just the flag we're interested in. * + These are the results of the two xor operations: * * fieldDst fieldSrc inner xor outer xor * 0 0 0 0 * 0 1 1 1 * 1 0 1 0 * 1 1 0 1 */ internal void Copy(SimpleBitVector32 src, int bit) { data ^= (data ^ src.data) & bit; } internal int Data { get { return data; } set { data = value; } } #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ClaimComparer.cs
- CssClassPropertyAttribute.cs
- TextChangedEventArgs.cs
- NestedContainer.cs
- SchemaLookupTable.cs
- SqlRemoveConstantOrderBy.cs
- ImpersonationContext.cs
- UidManager.cs
- ModelUIElement3D.cs
- DeleteCardRequest.cs
- ArgumentOutOfRangeException.cs
- RegexCode.cs
- Task.cs
- Pts.cs
- sqlpipe.cs
- TransactionScope.cs
- UTF7Encoding.cs
- RegexReplacement.cs
- Int64.cs
- StateChangeEvent.cs
- StdRegProviderWrapper.cs
- DataPointer.cs
- WebRequestModuleElement.cs
- Int16KeyFrameCollection.cs
- PersonalizationProvider.cs
- TrackingStringDictionary.cs
- ObjectReferenceStack.cs
- HostProtectionException.cs
- SimpleWebHandlerParser.cs
- IndependentlyAnimatedPropertyMetadata.cs
- ConnectionPoolManager.cs
- CheckBox.cs
- GraphicsPath.cs
- ValueTable.cs
- RSACryptoServiceProvider.cs
- TraceContextRecord.cs
- GroupBox.cs
- WebPartZoneBase.cs
- DataGrid.cs
- Function.cs
- CharConverter.cs
- ListViewCancelEventArgs.cs
- MemberAccessException.cs
- ClientBuildManager.cs
- DurableInstancingOptions.cs
- EntityContainerRelationshipSetEnd.cs
- XmlNullResolver.cs
- TypeValidationEventArgs.cs
- MultilineStringConverter.cs
- _NetRes.cs
- ActivitySurrogate.cs
- X509Certificate2.cs
- QueryAsyncResult.cs
- ServicesUtilities.cs
- PeerObject.cs
- CapabilitiesPattern.cs
- QilPatternFactory.cs
- ListViewDataItem.cs
- RegistryKey.cs
- OracleString.cs
- cryptoapiTransform.cs
- MiniAssembly.cs
- XmlSerializer.cs
- FixedSOMElement.cs
- ClientUtils.cs
- Range.cs
- SourceFileInfo.cs
- securestring.cs
- DataGridRelationshipRow.cs
- Behavior.cs
- EntryPointNotFoundException.cs
- DbConnectionClosed.cs
- SlipBehavior.cs
- FormatException.cs
- EntityDataSourceViewSchema.cs
- EntityDescriptor.cs
- TextServicesManager.cs
- XmlSchemaAppInfo.cs
- NavigatorOutput.cs
- ProfileParameter.cs
- BitmapMetadataBlob.cs
- ContractHandle.cs
- IChannel.cs
- DataGridColumnHeaderCollection.cs
- GCHandleCookieTable.cs
- PrintSystemException.cs
- SerTrace.cs
- GridItemPatternIdentifiers.cs
- HostSecurityManager.cs
- MatcherBuilder.cs
- DataServiceQueryException.cs
- DependentList.cs
- lengthconverter.cs
- SqlDataAdapter.cs
- BinaryUtilClasses.cs
- DesignOnlyAttribute.cs
- WorkflowOperationBehavior.cs
- ISessionStateStore.cs
- ErrorRuntimeConfig.cs
- LockCookie.cs