code
stringlengths
114
1.05M
path
stringlengths
3
312
quality_prob
float64
0.5
0.99
learning_prob
float64
0.2
1
filename
stringlengths
3
168
kind
stringclasses
1 value
package graph import ( i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization" ) // ColumnDefinition provides operations to manage the drive singleton. type ColumnDefinition struct { Entity // This column stores boolean values. boolean BooleanColumnable; // This column's data is calculated based on other columns. calculated CalculatedColumnable; // This column stores data from a list of choices. choice ChoiceColumnable; // For site columns, the name of the group this column belongs to. Helps organize related columns. columnGroup *string; // This column stores content approval status. contentApprovalStatus ContentApprovalStatusColumnable; // This column stores currency values. currency CurrencyColumnable; // This column stores DateTime values. dateTime DateTimeColumnable; // The default value for this column. defaultValue DefaultColumnValueable; // The user-facing description of the column. description *string; // The user-facing name of the column. displayName *string; // If true, no two list items may have the same value for this column. enforceUniqueValues *bool; // This column stores a geolocation. geolocation GeolocationColumnable; // Specifies whether the column is displayed in the user interface. hidden *bool; // This column stores hyperlink or picture values. hyperlinkOrPicture HyperlinkOrPictureColumnable; // Specifies whether the column values can be used for sorting and searching. indexed *bool; // Indicates whether this column can be deleted. isDeletable *bool; // Indicates whether values in the column can be reordered. Read-only. isReorderable *bool; // Specifies whether the column can be changed. isSealed *bool; // This column's data is looked up from another source in the site. lookup LookupColumnable; // The API-facing name of the column as it appears in the [fields][] on a [listItem][]. For the user-facing name, see displayName. name *string; // This column stores number values. number NumberColumnable; // This column stores Person or Group values. personOrGroup PersonOrGroupColumnable; // If 'true', changes to this column will be propagated to lists that implement the column. propagateChanges *bool; // Specifies whether the column values can be modified. readOnly *bool; // Specifies whether the column value isn't optional. required *bool; // The source column for the content type column. sourceColumn ColumnDefinitionable; // This column stores taxonomy terms. term TermColumnable; // This column stores text values. text TextColumnable; // This column stores thumbnail values. thumbnail ThumbnailColumnable; // For site columns, the type of column. Read-only. type_escaped *ColumnTypes; // This column stores validation formula and message for the column. validation ColumnValidationable; } // NewColumnDefinition instantiates a new columnDefinition and sets the default values. func NewColumnDefinition()(*ColumnDefinition) { m := &ColumnDefinition{ Entity: *NewEntity(), } return m } // CreateColumnDefinitionFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value func CreateColumnDefinitionFromDiscriminatorValue(parseNode i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode)(i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.Parsable, error) { return NewColumnDefinition(), nil } // GetBoolean gets the boolean property value. This column stores boolean values. func (m *ColumnDefinition) GetBoolean()(BooleanColumnable) { if m == nil { return nil } else { return m.boolean } } // GetCalculated gets the calculated property value. This column's data is calculated based on other columns. func (m *ColumnDefinition) GetCalculated()(CalculatedColumnable) { if m == nil { return nil } else { return m.calculated } } // GetChoice gets the choice property value. This column stores data from a list of choices. func (m *ColumnDefinition) GetChoice()(ChoiceColumnable) { if m == nil { return nil } else { return m.choice } } // GetColumnGroup gets the columnGroup property value. For site columns, the name of the group this column belongs to. Helps organize related columns. func (m *ColumnDefinition) GetColumnGroup()(*string) { if m == nil { return nil } else { return m.columnGroup } } // GetContentApprovalStatus gets the contentApprovalStatus property value. This column stores content approval status. func (m *ColumnDefinition) GetContentApprovalStatus()(ContentApprovalStatusColumnable) { if m == nil { return nil } else { return m.contentApprovalStatus } } // GetCurrency gets the currency property value. This column stores currency values. func (m *ColumnDefinition) GetCurrency()(CurrencyColumnable) { if m == nil { return nil } else { return m.currency } } // GetDateTime gets the dateTime property value. This column stores DateTime values. func (m *ColumnDefinition) GetDateTime()(DateTimeColumnable) { if m == nil { return nil } else { return m.dateTime } } // GetDefaultValue gets the defaultValue property value. The default value for this column. func (m *ColumnDefinition) GetDefaultValue()(DefaultColumnValueable) { if m == nil { return nil } else { return m.defaultValue } } // GetDescription gets the description property value. The user-facing description of the column. func (m *ColumnDefinition) GetDescription()(*string) { if m == nil { return nil } else { return m.description } } // GetDisplayName gets the displayName property value. The user-facing name of the column. func (m *ColumnDefinition) GetDisplayName()(*string) { if m == nil { return nil } else { return m.displayName } } // GetEnforceUniqueValues gets the enforceUniqueValues property value. If true, no two list items may have the same value for this column. func (m *ColumnDefinition) GetEnforceUniqueValues()(*bool) { if m == nil { return nil } else { return m.enforceUniqueValues } } // GetFieldDeserializers the deserialization information for the current model func (m *ColumnDefinition) GetFieldDeserializers()(map[string]func(interface{}, i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode)(error)) { res := m.Entity.GetFieldDeserializers() res["boolean"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateBooleanColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetBoolean(val.(BooleanColumnable)) } return nil } res["calculated"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateCalculatedColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetCalculated(val.(CalculatedColumnable)) } return nil } res["choice"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateChoiceColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetChoice(val.(ChoiceColumnable)) } return nil } res["columnGroup"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetColumnGroup(val) } return nil } res["contentApprovalStatus"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateContentApprovalStatusColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetContentApprovalStatus(val.(ContentApprovalStatusColumnable)) } return nil } res["currency"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateCurrencyColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetCurrency(val.(CurrencyColumnable)) } return nil } res["dateTime"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateDateTimeColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetDateTime(val.(DateTimeColumnable)) } return nil } res["defaultValue"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateDefaultColumnValueFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetDefaultValue(val.(DefaultColumnValueable)) } return nil } res["description"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetDescription(val) } return nil } res["displayName"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetDisplayName(val) } return nil } res["enforceUniqueValues"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetEnforceUniqueValues(val) } return nil } res["geolocation"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateGeolocationColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetGeolocation(val.(GeolocationColumnable)) } return nil } res["hidden"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetHidden(val) } return nil } res["hyperlinkOrPicture"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateHyperlinkOrPictureColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetHyperlinkOrPicture(val.(HyperlinkOrPictureColumnable)) } return nil } res["indexed"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetIndexed(val) } return nil } res["isDeletable"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetIsDeletable(val) } return nil } res["isReorderable"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetIsReorderable(val) } return nil } res["isSealed"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetIsSealed(val) } return nil } res["lookup"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateLookupColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetLookup(val.(LookupColumnable)) } return nil } res["name"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetName(val) } return nil } res["number"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateNumberColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetNumber(val.(NumberColumnable)) } return nil } res["personOrGroup"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreatePersonOrGroupColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetPersonOrGroup(val.(PersonOrGroupColumnable)) } return nil } res["propagateChanges"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetPropagateChanges(val) } return nil } res["readOnly"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetReadOnly(val) } return nil } res["required"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetRequired(val) } return nil } res["sourceColumn"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateColumnDefinitionFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetSourceColumn(val.(ColumnDefinitionable)) } return nil } res["term"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateTermColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetTerm(val.(TermColumnable)) } return nil } res["text"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateTextColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetText(val.(TextColumnable)) } return nil } res["thumbnail"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateThumbnailColumnFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetThumbnail(val.(ThumbnailColumnable)) } return nil } res["type"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetEnumValue(ParseColumnTypes) if err != nil { return err } if val != nil { m.SetType(val.(*ColumnTypes)) } return nil } res["validation"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetObjectValue(CreateColumnValidationFromDiscriminatorValue) if err != nil { return err } if val != nil { m.SetValidation(val.(ColumnValidationable)) } return nil } return res } // GetGeolocation gets the geolocation property value. This column stores a geolocation. func (m *ColumnDefinition) GetGeolocation()(GeolocationColumnable) { if m == nil { return nil } else { return m.geolocation } } // GetHidden gets the hidden property value. Specifies whether the column is displayed in the user interface. func (m *ColumnDefinition) GetHidden()(*bool) { if m == nil { return nil } else { return m.hidden } } // GetHyperlinkOrPicture gets the hyperlinkOrPicture property value. This column stores hyperlink or picture values. func (m *ColumnDefinition) GetHyperlinkOrPicture()(HyperlinkOrPictureColumnable) { if m == nil { return nil } else { return m.hyperlinkOrPicture } } // GetIndexed gets the indexed property value. Specifies whether the column values can be used for sorting and searching. func (m *ColumnDefinition) GetIndexed()(*bool) { if m == nil { return nil } else { return m.indexed } } // GetIsDeletable gets the isDeletable property value. Indicates whether this column can be deleted. func (m *ColumnDefinition) GetIsDeletable()(*bool) { if m == nil { return nil } else { return m.isDeletable } } // GetIsReorderable gets the isReorderable property value. Indicates whether values in the column can be reordered. Read-only. func (m *ColumnDefinition) GetIsReorderable()(*bool) { if m == nil { return nil } else { return m.isReorderable } } // GetIsSealed gets the isSealed property value. Specifies whether the column can be changed. func (m *ColumnDefinition) GetIsSealed()(*bool) { if m == nil { return nil } else { return m.isSealed } } // GetLookup gets the lookup property value. This column's data is looked up from another source in the site. func (m *ColumnDefinition) GetLookup()(LookupColumnable) { if m == nil { return nil } else { return m.lookup } } // GetName gets the name property value. The API-facing name of the column as it appears in the [fields][] on a [listItem][]. For the user-facing name, see displayName. func (m *ColumnDefinition) GetName()(*string) { if m == nil { return nil } else { return m.name } } // GetNumber gets the number property value. This column stores number values. func (m *ColumnDefinition) GetNumber()(NumberColumnable) { if m == nil { return nil } else { return m.number } } // GetPersonOrGroup gets the personOrGroup property value. This column stores Person or Group values. func (m *ColumnDefinition) GetPersonOrGroup()(PersonOrGroupColumnable) { if m == nil { return nil } else { return m.personOrGroup } } // GetPropagateChanges gets the propagateChanges property value. If 'true', changes to this column will be propagated to lists that implement the column. func (m *ColumnDefinition) GetPropagateChanges()(*bool) { if m == nil { return nil } else { return m.propagateChanges } } // GetReadOnly gets the readOnly property value. Specifies whether the column values can be modified. func (m *ColumnDefinition) GetReadOnly()(*bool) { if m == nil { return nil } else { return m.readOnly } } // GetRequired gets the required property value. Specifies whether the column value isn't optional. func (m *ColumnDefinition) GetRequired()(*bool) { if m == nil { return nil } else { return m.required } } // GetSourceColumn gets the sourceColumn property value. The source column for the content type column. func (m *ColumnDefinition) GetSourceColumn()(ColumnDefinitionable) { if m == nil { return nil } else { return m.sourceColumn } } // GetTerm gets the term property value. This column stores taxonomy terms. func (m *ColumnDefinition) GetTerm()(TermColumnable) { if m == nil { return nil } else { return m.term } } // GetText gets the text property value. This column stores text values. func (m *ColumnDefinition) GetText()(TextColumnable) { if m == nil { return nil } else { return m.text } } // GetThumbnail gets the thumbnail property value. This column stores thumbnail values. func (m *ColumnDefinition) GetThumbnail()(ThumbnailColumnable) { if m == nil { return nil } else { return m.thumbnail } } // GetType gets the type property value. For site columns, the type of column. Read-only. func (m *ColumnDefinition) GetType()(*ColumnTypes) { if m == nil { return nil } else { return m.type_escaped } } // GetValidation gets the validation property value. This column stores validation formula and message for the column. func (m *ColumnDefinition) GetValidation()(ColumnValidationable) { if m == nil { return nil } else { return m.validation } } func (m *ColumnDefinition) IsNil()(bool) { return m == nil } // Serialize serializes information the current object func (m *ColumnDefinition) Serialize(writer i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.SerializationWriter)(error) { err := m.Entity.Serialize(writer) if err != nil { return err } { err = writer.WriteObjectValue("boolean", m.GetBoolean()) if err != nil { return err } } { err = writer.WriteObjectValue("calculated", m.GetCalculated()) if err != nil { return err } } { err = writer.WriteObjectValue("choice", m.GetChoice()) if err != nil { return err } } { err = writer.WriteStringValue("columnGroup", m.GetColumnGroup()) if err != nil { return err } } { err = writer.WriteObjectValue("contentApprovalStatus", m.GetContentApprovalStatus()) if err != nil { return err } } { err = writer.WriteObjectValue("currency", m.GetCurrency()) if err != nil { return err } } { err = writer.WriteObjectValue("dateTime", m.GetDateTime()) if err != nil { return err } } { err = writer.WriteObjectValue("defaultValue", m.GetDefaultValue()) if err != nil { return err } } { err = writer.WriteStringValue("description", m.GetDescription()) if err != nil { return err } } { err = writer.WriteStringValue("displayName", m.GetDisplayName()) if err != nil { return err } } { err = writer.WriteBoolValue("enforceUniqueValues", m.GetEnforceUniqueValues()) if err != nil { return err } } { err = writer.WriteObjectValue("geolocation", m.GetGeolocation()) if err != nil { return err } } { err = writer.WriteBoolValue("hidden", m.GetHidden()) if err != nil { return err } } { err = writer.WriteObjectValue("hyperlinkOrPicture", m.GetHyperlinkOrPicture()) if err != nil { return err } } { err = writer.WriteBoolValue("indexed", m.GetIndexed()) if err != nil { return err } } { err = writer.WriteBoolValue("isDeletable", m.GetIsDeletable()) if err != nil { return err } } { err = writer.WriteBoolValue("isReorderable", m.GetIsReorderable()) if err != nil { return err } } { err = writer.WriteBoolValue("isSealed", m.GetIsSealed()) if err != nil { return err } } { err = writer.WriteObjectValue("lookup", m.GetLookup()) if err != nil { return err } } { err = writer.WriteStringValue("name", m.GetName()) if err != nil { return err } } { err = writer.WriteObjectValue("number", m.GetNumber()) if err != nil { return err } } { err = writer.WriteObjectValue("personOrGroup", m.GetPersonOrGroup()) if err != nil { return err } } { err = writer.WriteBoolValue("propagateChanges", m.GetPropagateChanges()) if err != nil { return err } } { err = writer.WriteBoolValue("readOnly", m.GetReadOnly()) if err != nil { return err } } { err = writer.WriteBoolValue("required", m.GetRequired()) if err != nil { return err } } { err = writer.WriteObjectValue("sourceColumn", m.GetSourceColumn()) if err != nil { return err } } { err = writer.WriteObjectValue("term", m.GetTerm()) if err != nil { return err } } { err = writer.WriteObjectValue("text", m.GetText()) if err != nil { return err } } { err = writer.WriteObjectValue("thumbnail", m.GetThumbnail()) if err != nil { return err } } if m.GetType() != nil { cast := (*m.GetType()).String() err = writer.WriteStringValue("type", &cast) if err != nil { return err } } { err = writer.WriteObjectValue("validation", m.GetValidation()) if err != nil { return err } } return nil } // SetBoolean sets the boolean property value. This column stores boolean values. func (m *ColumnDefinition) SetBoolean(value BooleanColumnable)() { if m != nil { m.boolean = value } } // SetCalculated sets the calculated property value. This column's data is calculated based on other columns. func (m *ColumnDefinition) SetCalculated(value CalculatedColumnable)() { if m != nil { m.calculated = value } } // SetChoice sets the choice property value. This column stores data from a list of choices. func (m *ColumnDefinition) SetChoice(value ChoiceColumnable)() { if m != nil { m.choice = value } } // SetColumnGroup sets the columnGroup property value. For site columns, the name of the group this column belongs to. Helps organize related columns. func (m *ColumnDefinition) SetColumnGroup(value *string)() { if m != nil { m.columnGroup = value } } // SetContentApprovalStatus sets the contentApprovalStatus property value. This column stores content approval status. func (m *ColumnDefinition) SetContentApprovalStatus(value ContentApprovalStatusColumnable)() { if m != nil { m.contentApprovalStatus = value } } // SetCurrency sets the currency property value. This column stores currency values. func (m *ColumnDefinition) SetCurrency(value CurrencyColumnable)() { if m != nil { m.currency = value } } // SetDateTime sets the dateTime property value. This column stores DateTime values. func (m *ColumnDefinition) SetDateTime(value DateTimeColumnable)() { if m != nil { m.dateTime = value } } // SetDefaultValue sets the defaultValue property value. The default value for this column. func (m *ColumnDefinition) SetDefaultValue(value DefaultColumnValueable)() { if m != nil { m.defaultValue = value } } // SetDescription sets the description property value. The user-facing description of the column. func (m *ColumnDefinition) SetDescription(value *string)() { if m != nil { m.description = value } } // SetDisplayName sets the displayName property value. The user-facing name of the column. func (m *ColumnDefinition) SetDisplayName(value *string)() { if m != nil { m.displayName = value } } // SetEnforceUniqueValues sets the enforceUniqueValues property value. If true, no two list items may have the same value for this column. func (m *ColumnDefinition) SetEnforceUniqueValues(value *bool)() { if m != nil { m.enforceUniqueValues = value } } // SetGeolocation sets the geolocation property value. This column stores a geolocation. func (m *ColumnDefinition) SetGeolocation(value GeolocationColumnable)() { if m != nil { m.geolocation = value } } // SetHidden sets the hidden property value. Specifies whether the column is displayed in the user interface. func (m *ColumnDefinition) SetHidden(value *bool)() { if m != nil { m.hidden = value } } // SetHyperlinkOrPicture sets the hyperlinkOrPicture property value. This column stores hyperlink or picture values. func (m *ColumnDefinition) SetHyperlinkOrPicture(value HyperlinkOrPictureColumnable)() { if m != nil { m.hyperlinkOrPicture = value } } // SetIndexed sets the indexed property value. Specifies whether the column values can be used for sorting and searching. func (m *ColumnDefinition) SetIndexed(value *bool)() { if m != nil { m.indexed = value } } // SetIsDeletable sets the isDeletable property value. Indicates whether this column can be deleted. func (m *ColumnDefinition) SetIsDeletable(value *bool)() { if m != nil { m.isDeletable = value } } // SetIsReorderable sets the isReorderable property value. Indicates whether values in the column can be reordered. Read-only. func (m *ColumnDefinition) SetIsReorderable(value *bool)() { if m != nil { m.isReorderable = value } } // SetIsSealed sets the isSealed property value. Specifies whether the column can be changed. func (m *ColumnDefinition) SetIsSealed(value *bool)() { if m != nil { m.isSealed = value } } // SetLookup sets the lookup property value. This column's data is looked up from another source in the site. func (m *ColumnDefinition) SetLookup(value LookupColumnable)() { if m != nil { m.lookup = value } } // SetName sets the name property value. The API-facing name of the column as it appears in the [fields][] on a [listItem][]. For the user-facing name, see displayName. func (m *ColumnDefinition) SetName(value *string)() { if m != nil { m.name = value } } // SetNumber sets the number property value. This column stores number values. func (m *ColumnDefinition) SetNumber(value NumberColumnable)() { if m != nil { m.number = value } } // SetPersonOrGroup sets the personOrGroup property value. This column stores Person or Group values. func (m *ColumnDefinition) SetPersonOrGroup(value PersonOrGroupColumnable)() { if m != nil { m.personOrGroup = value } } // SetPropagateChanges sets the propagateChanges property value. If 'true', changes to this column will be propagated to lists that implement the column. func (m *ColumnDefinition) SetPropagateChanges(value *bool)() { if m != nil { m.propagateChanges = value } } // SetReadOnly sets the readOnly property value. Specifies whether the column values can be modified. func (m *ColumnDefinition) SetReadOnly(value *bool)() { if m != nil { m.readOnly = value } } // SetRequired sets the required property value. Specifies whether the column value isn't optional. func (m *ColumnDefinition) SetRequired(value *bool)() { if m != nil { m.required = value } } // SetSourceColumn sets the sourceColumn property value. The source column for the content type column. func (m *ColumnDefinition) SetSourceColumn(value ColumnDefinitionable)() { if m != nil { m.sourceColumn = value } } // SetTerm sets the term property value. This column stores taxonomy terms. func (m *ColumnDefinition) SetTerm(value TermColumnable)() { if m != nil { m.term = value } } // SetText sets the text property value. This column stores text values. func (m *ColumnDefinition) SetText(value TextColumnable)() { if m != nil { m.text = value } } // SetThumbnail sets the thumbnail property value. This column stores thumbnail values. func (m *ColumnDefinition) SetThumbnail(value ThumbnailColumnable)() { if m != nil { m.thumbnail = value } } // SetType sets the type property value. For site columns, the type of column. Read-only. func (m *ColumnDefinition) SetType(value *ColumnTypes)() { if m != nil { m.type_escaped = value } } // SetValidation sets the validation property value. This column stores validation formula and message for the column. func (m *ColumnDefinition) SetValidation(value ColumnValidationable)() { if m != nil { m.validation = value } }
models/microsoft/graph/column_definition.go
0.746878
0.435601
column_definition.go
starcoder
package pgverify import ( "fmt" log "github.com/sirupsen/logrus" ) const ( // A full test is the default test mode. It is the only test mode that checks all // of the rows of a given table, guaranteeing equivalent values between targets. TestModeFull = "full" // The bookend test is similar to the full test mode, but it only checks a certain // number of rows from the beginning and end of the table, sorted by primary key. TestModeBookend = "bookend" // The number of rows checked in the bookend test mode is configurable. TestModeBookendDefaultLimit = 1000 // A sparse test checks a deterministic subset of the rows in a table. TestModeSparse = "sparse" // The number of rows checked in the sparse test mode is configurable, // equalling approximately 1/mod of the total. TestModeSparseDefaultMod = 10 // A rowcount test simply compares table row counts between targets. TestModeRowCount = "rowcount" ) // Config represents the configuration for running a verification. type Config struct { // Filters for which schemas and tables to run verification tests on. // Exclude overrides Include. IncludeTables []string ExcludeTables []string IncludeSchemas []string ExcludeSchemas []string // TestModes is a list of test modes to run, executed in order. TestModes []string // BookendLimit is the number of rows to include when running a bookend test. BookendLimit int // SparseMod is used in the sparse test mode to deterministically select a // subset of rows, approximately 1/mod of the total. SparseMod int // Aliases is a list of aliases to use for the target databases in reporting // output. Is ignored if the number of aliases is not equal to the number of // supplied targets. Aliases []string Logger *log.Logger } // Option interface used for setting optional config properties. type Option interface { apply(*Config) } type optionFunc func(*Config) func (o optionFunc) apply(c *Config) { o(c) } // NewConfig returns a new Config with default values overriden // by the supplied Options. func NewConfig(opts ...Option) Config { c := Config{} defaultOpts := []Option{ WithLogger(log.StandardLogger()), WithTests(TestModeFull), WithBookendLimit(TestModeBookendDefaultLimit), WithSparseMod(TestModeSparseDefaultMod), } for _, opt := range append(defaultOpts, opts...) { opt.apply(&c) } return c } // Validate checks that the configuration contains valid values. func (c Config) Validate() error { for _, mode := range c.TestModes { switch mode { case TestModeBookend: case TestModeFull: case TestModeRowCount: case TestModeSparse: default: return fmt.Errorf("invalid strategy: %s", c.TestModes) } } return nil } // WithLogger sets the logger configuration. func WithLogger(logger *log.Logger) optionFunc { return func(c *Config) { c.Logger = logger } } // ExcludeSchemas sets the exclude schemas configuration. func ExcludeSchemas(schemas ...string) optionFunc { return func(c *Config) { c.ExcludeSchemas = schemas } } // IncludeSchemas sets the include schemas configuration. func IncludeSchemas(schemas ...string) optionFunc { return func(c *Config) { c.IncludeSchemas = schemas } } // ExcludeTables sets the exclude tables configuration. func ExcludeTables(tables ...string) optionFunc { return func(c *Config) { c.ExcludeTables = tables } } // IncludeTables sets the include tables configuration. func IncludeTables(tables ...string) optionFunc { return func(c *Config) { c.IncludeTables = tables } } // WithTests defines the tests to run. func WithTests(testModes ...string) optionFunc { return func(c *Config) { c.TestModes = testModes } } // WithBookendLimit sets the bookend limit configuration used in // the bookend test mode. func WithBookendLimit(limit int) optionFunc { return func(c *Config) { c.BookendLimit = limit } } // WithSparseMod sets the sparse mod configuration used in // the sparse test mode. func WithSparseMod(mod int) optionFunc { return func(c *Config) { c.SparseMod = mod } } // WithAliases sets the aliases for the target databases. Is ignored if not equal // to the number of targets. func WithAliases(aliases []string) optionFunc { return func(c *Config) { c.Aliases = aliases } }
config.go
0.75392
0.469581
config.go
starcoder
package parser import ( "code.google.com/p/goyaml/token" ) // Document stores data related to a single document in a stream. type Document struct { MajorVersion int MinorVersion int Content Node } // Node defines a node of the representation graph. type Node interface { Start() token.Position Tag() string Data() interface{} setTag(string) setData(interface{}) } type basicNode struct { pos token.Position tag string hasData bool data interface{} } func (n basicNode) Start() token.Position { return n.pos } func (n basicNode) Tag() string { return n.tag } func (n basicNode) Data() interface{} { return n.data } func (n *basicNode) setTag(t string) { n.tag = t } func (n *basicNode) setData(d interface{}) { n.hasData = true; n.data = d } // An Empty indicates a lack of a value. type Empty struct { *basicNode } // A KeyValuePair stores a single pair in a mapping. type KeyValuePair struct { Key, Value Node } // Mapping stores a key-value mapping of nodes. type Mapping struct { *basicNode Pairs []KeyValuePair } // Len returns the number of pairs in the mapping. func (m *Mapping) Len() int { return len(m.Pairs) } // Get returns the value for a scalar that has the same content as key. func (m *Mapping) Get(key string) (value Node, ok bool) { for _, pair := range m.Pairs { if pairKey, convOk := pair.Key.Data().(string); convOk && pairKey == key { return pair.Value, true } } return nil, false } // Map returns the content of the mapping as a native Go map. func (node *Mapping) Map() (m map[interface{}]interface{}) { m = make(map[interface{}]interface{}, len(node.Pairs)) for _, pair := range node.Pairs { m[pair.Key.Data()] = pair.Value.Data() } return } // Sequence stores an ordered collection of nodes. type Sequence struct { *basicNode Nodes []Node } // At returns the node at the given index. func (seq *Sequence) At(i int) Node { return seq.Nodes[i] } // Len returns the number of nodes in the sequence. func (seq *Sequence) Len() int { return len(seq.Nodes) } // Slice returns the content of the sequence as a native Go slice. func (seq *Sequence) Slice() (s []interface{}) { s = make([]interface{}, len(seq.Nodes)) for i, n := range seq.Nodes { s[i] = n.Data() } return } // Scalar stores a text value. type Scalar struct { *basicNode Value string } // String returns the original string that was used to construct the value. func (s *Scalar) String() string { return s.Value }
parser/ast.go
0.837387
0.566678
ast.go
starcoder
package multiMeasurement import ( "fmt" "time" "math/rand" "github.com/influxdata/influxdb-comparisons/bulk_data_gen/common" ) const MeasSig = "Measurement-%d" const FieldSig = "Field-%d" const NumFields = 1 // number of fields for each measurement const MeasMultiplier = 50 // scaleVar * measMultiplier = number of unique measurements type MeasurementSimulatorConfig struct { Start time.Time End time.Time ScaleFactor int } func (d *MeasurementSimulatorConfig) ToSimulator() *MeasurementSimulator { s := d.ScaleFactor * MeasMultiplier // number of measurements to create dg := &MeasurementSimulator{ madePoints: 0, madeValues: 0, maxPoints: int64(s * 50), // 50 points per measurement, or approx. 1 per shard for a year of data fieldList: make([][]byte, NumFields), measList: make([][]byte, s), timestampNow: d.Start, timestampStart: d.Start, timestampEnd: d.End, } for i := 0; i < s; i++ { dg.measList[i] = []byte(fmt.Sprintf(MeasSig, i)) } for i := 0; i < NumFields; i++ { dg.fieldList[i] = []byte(fmt.Sprintf(FieldSig, i)) } dg.stepTime = time.Duration(int64(dg.timestampEnd.Sub(dg.timestampStart)) / dg.maxPoints) return dg } // MeasurementSimulator fullfills the Simulator interface. type MeasurementSimulator struct { madePoints int64 maxPoints int64 madeValues int64 fieldList [][]byte measList [][]byte timestampNow time.Time timestampStart time.Time timestampEnd time.Time stepTime time.Duration } func (g *MeasurementSimulator) SeenPoints() int64 { return g.madePoints } func (g *MeasurementSimulator) SeenValues() int64 { return g.madeValues } func (g *MeasurementSimulator) Total() int64 { return g.maxPoints } func (g *MeasurementSimulator) Finished() bool { return g.madePoints >= g.maxPoints } // Next advances a Point to the next state in the generator. func (g *MeasurementSimulator) Next(p *common.Point) { p.SetMeasurementName(g.measList[rand.Intn(len(g.measList))]) p.SetTimestamp(&g.timestampNow) for _, f := range g.fieldList { p.AppendField(f, rand.Float64()) } g.madePoints++ g.madeValues += int64(len(g.fieldList)) g.timestampNow = g.timestampNow.Add(g.stepTime) }
bulk_data_gen/multi_measurement/generate_data.go
0.653348
0.419886
generate_data.go
starcoder
package graph import ( i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55 "github.com/microsoft/kiota/abstractions/go/serialization" ) // OptionalClaim type OptionalClaim struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. additionalData map[string]interface{}; // Additional properties of the claim. If a property exists in this collection, it modifies the behavior of the optional claim specified in the name property. additionalProperties []string; // If the value is true, the claim specified by the client is necessary to ensure a smooth authorization experience for the specific task requested by the end user. The default value is false. essential *bool; // The name of the optional claim. name *string; // The source (directory object) of the claim. There are predefined claims and user-defined claims from extension properties. If the source value is null, the claim is a predefined optional claim. If the source value is user, the value in the name property is the extension property from the user object. source *string; } // NewOptionalClaim instantiates a new optionalClaim and sets the default values. func NewOptionalClaim()(*OptionalClaim) { m := &OptionalClaim{ } m.SetAdditionalData(make(map[string]interface{})); return m } // GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. func (m *OptionalClaim) GetAdditionalData()(map[string]interface{}) { if m == nil { return nil } else { return m.additionalData } } // GetAdditionalProperties gets the additionalProperties property value. Additional properties of the claim. If a property exists in this collection, it modifies the behavior of the optional claim specified in the name property. func (m *OptionalClaim) GetAdditionalProperties()([]string) { if m == nil { return nil } else { return m.additionalProperties } } // GetEssential gets the essential property value. If the value is true, the claim specified by the client is necessary to ensure a smooth authorization experience for the specific task requested by the end user. The default value is false. func (m *OptionalClaim) GetEssential()(*bool) { if m == nil { return nil } else { return m.essential } } // GetName gets the name property value. The name of the optional claim. func (m *OptionalClaim) GetName()(*string) { if m == nil { return nil } else { return m.name } } // GetSource gets the source property value. The source (directory object) of the claim. There are predefined claims and user-defined claims from extension properties. If the source value is null, the claim is a predefined optional claim. If the source value is user, the value in the name property is the extension property from the user object. func (m *OptionalClaim) GetSource()(*string) { if m == nil { return nil } else { return m.source } } // GetFieldDeserializers the deserialization information for the current model func (m *OptionalClaim) GetFieldDeserializers()(map[string]func(interface{}, i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode)(error)) { res := make(map[string]func(interface{}, i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode)(error)) res["additionalProperties"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetCollectionOfPrimitiveValues("string") if err != nil { return err } if val != nil { res := make([]string, len(val)) for i, v := range val { res[i] = *(v.(*string)) } m.SetAdditionalProperties(res) } return nil } res["essential"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetBoolValue() if err != nil { return err } if val != nil { m.SetEssential(val) } return nil } res["name"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetName(val) } return nil } res["source"] = func (o interface{}, n i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { m.SetSource(val) } return nil } return res } func (m *OptionalClaim) IsNil()(bool) { return m == nil } // Serialize serializes information the current object func (m *OptionalClaim) Serialize(writer i04eb5309aeaafadd28374d79c8471df9b267510b4dc2e3144c378c50f6fd7b55.SerializationWriter)(error) { { err := writer.WriteCollectionOfStringValues("additionalProperties", m.GetAdditionalProperties()) if err != nil { return err } } { err := writer.WriteBoolValue("essential", m.GetEssential()) if err != nil { return err } } { err := writer.WriteStringValue("name", m.GetName()) if err != nil { return err } } { err := writer.WriteStringValue("source", m.GetSource()) if err != nil { return err } } { err := writer.WriteAdditionalData(m.GetAdditionalData()) if err != nil { return err } } return nil } // SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. func (m *OptionalClaim) SetAdditionalData(value map[string]interface{})() { m.additionalData = value } // SetAdditionalProperties sets the additionalProperties property value. Additional properties of the claim. If a property exists in this collection, it modifies the behavior of the optional claim specified in the name property. func (m *OptionalClaim) SetAdditionalProperties(value []string)() { m.additionalProperties = value } // SetEssential sets the essential property value. If the value is true, the claim specified by the client is necessary to ensure a smooth authorization experience for the specific task requested by the end user. The default value is false. func (m *OptionalClaim) SetEssential(value *bool)() { m.essential = value } // SetName sets the name property value. The name of the optional claim. func (m *OptionalClaim) SetName(value *string)() { m.name = value } // SetSource sets the source property value. The source (directory object) of the claim. There are predefined claims and user-defined claims from extension properties. If the source value is null, the claim is a predefined optional claim. If the source value is user, the value in the name property is the extension property from the user object. func (m *OptionalClaim) SetSource(value *string)() { m.source = value }
models/microsoft/graph/optional_claim.go
0.776623
0.436622
optional_claim.go
starcoder
package server import ( "github.com/openzipkin/zipkin-go-opentracing" "github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/zipkincore" "github.com/prometheus/client_golang/prometheus" "strings" "time" ) // PrometheusCollector is a custom Collector // which sends ZipKin traces to Prometheus type PrometheusCollector struct { // Each span name is published as a separate Histogram metric // Using metric names of the form fn_span_<span-name>_duration_seconds // In this map, the key is the name of a tracing span, // and the corresponding value is a HistogramVec metric used to report the duration of spans with this name to Prometheus histogramVecMap map[string]*prometheus.HistogramVec // In this map, the key is the name of a tracing span, // and the corresponding value is an array containing the label keys that were specified when the HistogramVec metric was created registeredLabelKeysMap map[string][]string // In this map, the key is the name of a tracing span, // and the corresponding value is a SummaryVec metric which is useful to compute the quantiles of the duration of spans summaryVecMap map[string]*prometheus.SummaryVec } // NewPrometheusCollector returns a new PrometheusCollector func NewPrometheusCollector() (zipkintracer.Collector, error) { pc := &PrometheusCollector{ make(map[string]*prometheus.HistogramVec), make(map[string][]string), make(map[string]*prometheus.SummaryVec), } return pc, nil } // Collect implements Collector. func (pc PrometheusCollector) Collect(span *zipkincore.Span) error { var labelValuesToUse map[string]string // extract any label values from the span labelKeysFromSpan, labelValuesFromSpan := getLabels(span) // get the HistogramVec for this span name expectedLabelKeys, found := pc.registeredLabelKeysMap[span.GetName()] if !found { // create a new HistogramVec histogramVec := prometheus.NewHistogramVec( prometheus.HistogramOpts{ Name: "flow_span_" + span.GetName() + "_duration_secs_histogram", Help: "Span " + span.GetName() + " duration, by span name", }, labelKeysFromSpan, ) // create a new SummaryVec summaryVec := prometheus.NewSummaryVec( prometheus.SummaryOpts{ Name: "flow_span_" + span.GetName() + "_duration_secs_summary", Help: "Span " + span.GetName() + " duration, by span name", Objectives: map[float64]float64 {0.5: 0.01, 0.9: 0.01, 0.99: 0.001}, }, labelKeysFromSpan, ) pc.histogramVecMap[span.GetName()] = histogramVec prometheus.MustRegister(histogramVec) pc.summaryVecMap[span.GetName()] = summaryVec prometheus.MustRegister(summaryVec) pc.registeredLabelKeysMap[span.GetName()] = labelKeysFromSpan labelValuesToUse = labelValuesFromSpan } else { // found an existing span name // need to be careful here, since we must supply the same label keys as when we first created the metric // otherwise we will get a "inconsistent label cardinality" panic // that's why we saved the original label keys in the registeredLabelKeysMap map // so we can use that to construct a map of label key/value pairs to set on the metric labelValuesToUse = make(map[string]string) for _, thisRegisteredLabelKey := range expectedLabelKeys { if value, found := labelValuesFromSpan[thisRegisteredLabelKey]; found { labelValuesToUse[thisRegisteredLabelKey] = value } else { labelValuesToUse[thisRegisteredLabelKey] = "" } } } // now report the metric value pc.histogramVecMap[span.GetName()].With(labelValuesToUse).Observe((time.Duration(span.GetDuration()) * time.Microsecond).Seconds()) pc.summaryVecMap[span.GetName()].With(labelValuesToUse).Observe((time.Duration(span.GetDuration()) * time.Microsecond).Seconds()) return nil } // extract from the specified span the key/value pairs that we want to add as labels to the Prometheus metric for this span // returns an array of keys, and a map of key-value pairs func getLabels(span *zipkincore.Span) ([]string, map[string]string) { var keys []string labelMap := make(map[string]string) // extract any tags whose key starts with "fn" from the span binaryAnnotations := span.GetBinaryAnnotations() for _, thisBinaryAnnotation := range binaryAnnotations { key := thisBinaryAnnotation.GetKey() if thisBinaryAnnotation.GetAnnotationType() == zipkincore.AnnotationType_STRING && strings.HasPrefix(key, "fn") { keys = append(keys, key) value := string(thisBinaryAnnotation.GetValue()[:]) labelMap[key] = value } } return keys, labelMap } // Close implements Collector. func (PrometheusCollector) Close() error { return nil }
server/prom_zip_collector.go
0.820469
0.586345
prom_zip_collector.go
starcoder
// Package treepath implements the selection of nodes in an arbitrary tree // of objects with XPath-like espressions. // See path_test.go for usage example. package treepath import ( "strconv" "strings" ) // Element is the interface that must be satifsfied by a tree node in order to // enable the treepath FindElements search. type Element interface { // Parent returns the parent of the current element. Parent() Element // Children returns the children of the current element. Children() []Element // MatchTag returns true if the current element matches the Tag. MatchTag(string) bool // MatchTagText returns true if the current element matches both Tag and // Text value. MatchTagText(string, string) bool // MatchAttr returns true if the current element has an attribute that // matched the given Name. MatchAttr(string) bool // MatchAttrText returns true if the current element has an attribute that // matched the given Name and Text value. MatchAttrText(string, string) bool } // Path represents the compiled version of an XPath-like espression. type Path struct { segments []segment } // CompilePath creates an optimized version of an XPath-like string that // can be used to query elements in an element tree. func CompilePath(path string) (Path, error) { var comp compiler segments := comp.parsePath(path) if comp.err != ErrPath("") { return Path{nil}, comp.err } return Path{segments}, nil } // FindElements returns the descendant of root Element that matched the path. // NOTE: The root element is never matched. func (path Path) FindElements(root Element) []Element { p := newPather() return p.traverse(root, path) } // A segment is a portion of a path between "/" characters. // It contains one selector and zero or more [filters]. type segment struct { sel selector filters []filter } // A selector selects XML elements for consideration by the // path traversal. type selector interface { apply(e Element, p *pather) } // A filter pares down a list of candidate XML elements based // on a path filter in [brackets]. type filter interface { apply(p *pather) } // A pather is helper object that traverses an element tree using // a Path object. It collects and deduplicates all elements matching // the path query. type pather struct { queue *fifo results []Element inResults map[Element]bool candidates []Element scratch []Element // used by filters } // A node represents an element and the remaining path segments that // should be applied against it by the pather. type node struct { e Element segments []segment } // A compiler generates a compiled path from a path string. type compiler struct { err ErrPath } // ErrPath is returned by path functions when an invalid path is provided. type ErrPath string // Error returns the string describing a path error. func (err ErrPath) Error() string { return "treepath: " + string(err) } // parsePath parses an XPath-like string describing a path // through an element tree and returns a slice of segment // descriptors. func (c *compiler) parsePath(path string) []segment { // If path starts or ends with //, fix it if strings.HasPrefix(path, "//") { path = "." + path } if strings.HasSuffix(path, "//") { path = path + "*" } // Paths cannot be absolute if strings.HasPrefix(path, "/") { c.err = ErrPath("paths cannot be absolute.") return nil } // Split path into segment objects var segments []segment for _, s := range splitPath(path) { segments = append(segments, c.parseSegment(s)) if c.err != ErrPath("") { break } } return segments } // splitPath splits a path in the segments between / characters. // It handles the / characters eventually contained in the text values of path. func splitPath(path string) []string { pieces := make([]string, 0) start := 0 inquote := false for i := 0; i+1 <= len(path); i++ { if path[i] == '\'' { inquote = !inquote } else if path[i] == '/' && !inquote { pieces = append(pieces, path[start:i]) start = i + 1 } } return append(pieces, path[start:]) } // parseSegment parses a path segment between / characters. func (c *compiler) parseSegment(path string) segment { pieces := strings.Split(path, "[") seg := segment{ sel: c.parseSelector(pieces[0]), filters: make([]filter, 0), } for i := 1; i < len(pieces); i++ { fpath := pieces[i] last := len(fpath) - 1 if last < 0 || fpath[last] != ']' { c.err = ErrPath("path has invalid filter [brackets].") break } seg.filters = append(seg.filters, c.parseFilter(fpath[:last])) } return seg } // parseSelector parses a selector at the start of a path segment. func (c *compiler) parseSelector(path string) selector { switch path { case ".": return new(selectSelf) case "..": return new(selectParent) case "*": return new(selectChildren) case "": return new(selectDescendants) default: return newSelectChildrenByTag(path) } } // parseFilter parses a path filter contained within [brackets]. func (c *compiler) parseFilter(path string) filter { if len(path) == 0 { c.err = ErrPath("path contains an empty filter expression.") return nil } // Filter contains [@attr='text'] or [tag='text']? eqindex := strings.Index(path, "='") if eqindex >= 0 { rindex := nextIndex(path, "'", eqindex+2) if rindex != len(path)-1 { c.err = ErrPath("path has mismatched filter quotes.") return nil } switch { case path[0] == '@': // [@attr='text'] return newFilterAttrText(path[1:eqindex], path[eqindex+2:rindex]) default: // [tag='text'] return newFilterChildText(path[:eqindex], path[eqindex+2:rindex]) } } // Filter contains [@attr], [N] or [tag] switch { case path[0] == '@': // [@attr] return newFilterAttr(path[1:]) case isInteger(path): // [N] pos, _ := strconv.Atoi(path) switch { case pos > 0: return newFilterPos(pos - 1) default: return newFilterPos(pos) } default: // [tag] return newFilterChild(path) } } func (seg *segment) apply(e Element, p *pather) { seg.sel.apply(e, p) for _, f := range seg.filters { f.apply(p) } } func newPather() *pather { return &pather{ queue: newFifo(), results: make([]Element, 0), inResults: make(map[Element]bool), candidates: make([]Element, 0), scratch: make([]Element, 0), } } // traverse follows the path from the element e, collecting // and then returning all elements that match the path's selectors // and filters. func (p *pather) traverse(e Element, path Path) []Element { for p.queue.Push(&node{e, path.segments}); p.queue.Len() > 0; { p.eval(p.queue.Pop()) } return p.results } // eval evalutes the current path node by applying the remaining // path's selector rules against the node's element. func (p *pather) eval(n *node) { p.candidates = p.candidates[0:0] seg, remain := n.segments[0], n.segments[1:] seg.apply(n.e, p) if len(remain) == 0 { for _, c := range p.candidates { if in := p.inResults[c]; !in { p.inResults[c] = true p.results = append(p.results, c) } } } else { for _, c := range p.candidates { p.queue.Push(&node{c, remain}) } } }
path.go
0.849909
0.583945
path.go
starcoder
package multiplicity import ( "github.com/00security/grammes/query/cardinality" "github.com/00security/grammes/query/direction" ) // Titan: // http://titan.thinkaurelius.com/javadoc/1.0.0/com/thinkaurelius/titan/core/Multiplicity.html // Wikipedia: // http://en.wikipedia.org/wiki/Class_diagram#Multiplicity // Object-oriented Systems Modeling Laboratory (OSM): // http://osm7.cs.byu.edu/OSA/participConst.html // Multiplicity acts as a property // set for an edge. This includes the // arrow being associated with the // direction of the edge. This is essentially // the cardinality and participation. type Multiplicity string const ( // Many2One shows that many vertices // connect to a single vertex. Similar // to One2Many but in the opposite direction. // Example: // person <-- --> birth place // left | right // 1..* or + | 1 Many2One Multiplicity = "MANY2ONE" // Many2Many shows that many vertices // connect to many other vertices. Similar // to Many2One, but instead of just one vertex // it's all just a cluster of vertices. // Example: // person <-- --> book // left | right // 0..* or * | 0..* or * Many2Many Multiplicity = "MANY2MANY" // One2Many describes an edge that // comes from multiple vertices and // point towards one vertex. // order <-- --> line item // left | right // 1 | 1..* or + One2Many Multiplicity = "ONE2MANY" // One2One explains that the vertex // being associated connects to one // going in a single direction. // person <-- --> birth certificate // left | right // 1 | 1 One2One Multiplicity = "ONE2ONE" // Simple does not have an associated // direction belonging to it. This // results in an edge with no arrows. Simple Multiplicity = "SIMPLE" // Multi is an arbitrary multiplicity // explaining that this edge will have // multiple arrows associated with it. // Wikipedia: // http://en.wikipedia.org/wiki/Multigraph Multi Multiplicity = "MULTI" ) // IsConstrained returns whether this multiplicity imposes // any constraint on the number of edges there may exist between a // pair of vertices. func (m Multiplicity) IsConstrained() bool { return m != Multi } // IsConstrainedDirection returns whether this multiplicity imposes // any constraint on the number of edges there may exist between a // pair of vertices. func (m Multiplicity) IsConstrainedDirection(d direction.Direction) bool { if d == direction.Both { return m != Multi } return m != Multi && (m == Simple || m.IsUnique(d)) } // IsUnique returns true if this multiplicity implies edge // uniqueness in the given direction for any given vertex. func (m Multiplicity) IsUnique(d direction.Direction) bool { switch d { case direction.In: return m == One2Many || m == One2One case direction.Out: return m == Many2One || m == One2One case direction.Both: return m == One2One default: return false } } // Convert will take a cardinality and return a matching Multiplicity. func Convert(c cardinality.Cardinality) Multiplicity { switch c { case cardinality.List: return Multi case cardinality.Set: return Simple case cardinality.Single: return Many2One default: return Multiplicity("Invalid Cardinality: " + c.String()) } } // String will convert the Multiplicity into a string. func (m Multiplicity) String() string { return string(m) } // Cardinality will convert the Multiplicity to a cardinality. func (m Multiplicity) Cardinality() cardinality.Cardinality { switch m { case Multi: return cardinality.List case Simple: return cardinality.Set case Many2One: return cardinality.Single default: return cardinality.Cardinality("Invalid Multiplicity: " + m.String()) } }
query/multiplicity/multiplicity.go
0.855263
0.422683
multiplicity.go
starcoder
package wasmtypes // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ const ScChainIDLength = 33 type ScChainID struct { id [ScChainIDLength]byte } // Address returns the alias address that the chain ID actually represents func (o ScChainID) Address() ScAddress { return AddressFromBytes(o.id[:]) } func (o ScChainID) Bytes() []byte { return ChainIDToBytes(o) } func (o ScChainID) String() string { return ChainIDToString(o) } // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ func ChainIDDecode(dec *WasmDecoder) ScChainID { return chainIDFromBytesUnchecked(dec.FixedBytes(ScChainIDLength)) } func ChainIDEncode(enc *WasmEncoder, value ScChainID) { enc.FixedBytes(value.Bytes(), ScChainIDLength) } func ChainIDFromBytes(buf []byte) ScChainID { if len(buf) == 0 { chainID := ScChainID{} chainID.id[0] = ScAddressAlias return chainID } if len(buf) != ScChainIDLength { panic("invalid ChainID length") } if buf[0] != ScAddressAlias { panic("invalid ChainID: not an alias address") } return chainIDFromBytesUnchecked(buf) } func ChainIDToBytes(value ScChainID) []byte { return value.id[:] } func ChainIDToString(value ScChainID) string { // TODO standardize human readable string return Base58Encode(value.id[:]) } func chainIDFromBytesUnchecked(buf []byte) ScChainID { o := ScChainID{} copy(o.id[:], buf) return o } // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ type ScImmutableChainID struct { proxy Proxy } func NewScImmutableChainID(proxy Proxy) ScImmutableChainID { return ScImmutableChainID{proxy: proxy} } func (o ScImmutableChainID) Exists() bool { return o.proxy.Exists() } func (o ScImmutableChainID) String() string { return ChainIDToString(o.Value()) } func (o ScImmutableChainID) Value() ScChainID { return ChainIDFromBytes(o.proxy.Get()) } // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ type ScMutableChainID struct { ScImmutableChainID } func NewScMutableChainID(proxy Proxy) ScMutableChainID { return ScMutableChainID{ScImmutableChainID{proxy: proxy}} } func (o ScMutableChainID) Delete() { o.proxy.Delete() } func (o ScMutableChainID) SetValue(value ScChainID) { o.proxy.Set(ChainIDToBytes(value)) }
packages/wasmvm/wasmlib/go/wasmlib/wasmtypes/scchainid.go
0.67694
0.604049
scchainid.go
starcoder
package vector import ( "errors" "fmt" "reflect" "strings" ) // Vector implements a persistent bit-partitioned vector trie, an array-like // persistent data structure. type Vector struct { count uint64 shift uint root *node tail *node start int } // New returns a new vector containing the given elements. func New(elems ...interface{}) *Vector { v := emptyVector for _, e := range elems { v = v.Append(e) } return v } // Append returns a new vector appending the element at the end of the vector. func (v *Vector) Append(elem interface{}) *Vector { if v.count-v.tailOffset() < uint64(vectorWidth) { lenTail := len(v.tail.values) tail := v.tail.cloneWithLen(lenTail + 1) tail.values[lenTail] = elem return &Vector{v.count + 1, v.shift, v.root, tail, 0} } var root *node tail := v.tail shift := v.shift if (v.count >> vectorBits) > (1 << v.shift) { root = &node{make([]interface{}, vectorWidth)} root.values[0] = v.root root.values[1] = newPath(tail) shift += uint(vectorBits) } else { root = v.pushTail(shift, v.root, tail) } tail = &node{[]interface{}{elem}} return &Vector{v.count + 1, shift, root, tail, 0} } // Get returns the element at the given position. If the position is negative, returns // elements in reverse order. If the element cannot be found in the vector, it // will return nil. func (v *Vector) Get(i int) interface{} { var key = uint64(i + v.start) if i < 0 { key = v.count + uint64(i) } if key >= v.count { return nil } tailOffset := v.tailOffset() if tailOffset == 0 || tailOffset-1 < key { return v.tail.values[key-tailOffset] } n := v.root for lvl := v.shift; lvl > 0; lvl -= uint(vectorBits) { n = n.values[(key>>lvl)&uint64(vectorMask)].(*node) } return n.values[key&uint64(vectorMask)] } // Set will change the value of the element at the given index. If the element // does not exist it will panic. func (v *Vector) Set(i int, elem interface{}) *Vector { var key = uint64(i + v.start) if i < 0 { key = v.count + uint64(i) } if key >= v.count { panic(fmt.Errorf("vector: index out of bounds, tried to get "+ "element %d of a vector with %d elements", key, v.count)) } tailOffset := v.tailOffset() if tailOffset == 0 || tailOffset-1 < key { newTail := v.tail.clone() newTail.values[key-tailOffset] = elem return &Vector{v.count, v.shift, v.root, newTail, v.start} } root := v.root.clone() n := root for lvl := v.shift; lvl > 0; lvl -= uint(vectorBits) { idx := (key >> lvl) & uint64(vectorMask) newNode := n.values[idx].(*node).clone() n.values[idx] = newNode n = newNode } n.values[key&uint64(vectorMask)] = elem return &Vector{v.count, v.shift, root, v.tail, v.start} } // ErrStop may be returned to stop iterating a vector. var ErrStop = errors.New("stop") // Range iterates over the vector to access all its elements. In order to stop // the iteration, ErrStop may be returned. Any other error will also terminate // the iteration and will also return that error. func (v *Vector) Range(f func(a interface{}) error) error { for i := 0; i < int(v.count); i++ { if err := f(v.Get(i)); err != nil { if err == ErrStop { return nil } return err } } return nil } // First returns the first element of the vector. func (v *Vector) First() interface{} { return v.Get(0) } // Last returns the last element of the vector. func (v *Vector) Last() interface{} { return v.Get(-1) } // Tail returns all the elements in the vector except for the first one. func (v *Vector) Tail() *Vector { return v.Drop(1) } // Count returns the number of elements in the vector. func (v *Vector) Count() int { return int(v.count) - int(v.start) } // pushTail pushes the tail to the rightmost node available and returns a new root. func (v *Vector) pushTail(shift uint, root, tail *node) *node { newRoot := root.clone() newNode := tail idx := ((v.count - 1) >> shift) & uint64(vectorWidth-1) if shift > uint(vectorBits) { shift -= uint(vectorBits) if n, ok := root.values[idx].(*node); ok { newNode = v.pushTail(shift, n, tail) } else { newNode = newPath(tail) } } newRoot.values[idx] = newNode return newRoot } // tailOffset returns the offset of elements that are not on the tail. func (v *Vector) tailOffset() uint64 { if v.count < uint64(vectorWidth) { return 0 } return ((v.count - 1) >> 5) << 5 } // Slice returns the elements of the vector in a slice. func (v *Vector) Slice() []interface{} { size := int(v.count) - v.start var result = make([]interface{}, size) for i := 0; i < size; i++ { result[i] = v.Get(i) } return result } // Map returns a new vector with the elements of the current vector after // applying the given map function. func (v *Vector) Map(f func(interface{}) interface{}) *Vector { result := New() for i := 0; i < int(v.count); i++ { result = result.Append(f(v.Get(i))) } return result } // Filter returns a new vector with the elements of the current vector if they // satisfy the given filter function. func (v *Vector) Filter(f func(interface{}) bool) *Vector { result := New() for i := 0; i < int(v.count); i++ { elem := v.Get(i) if f(elem) { result = result.Append(elem) } } return result } // Take returns a new vector with the first n elements of this vector. func (v *Vector) Take(n int) *Vector { if uint64(n) >= v.count { return v } result := New() for i := 0; i < n; i++ { result = result.Append(v.Get(i)) } return result } // Drop returns a new vector with all the elements in this vector dropping the // first n elements. func (v *Vector) Drop(n int) *Vector { if n < 0 { panic("cannot drop less than 0 items") } if uint64(v.start+n) >= v.count { return New() } return &Vector{ v.count, v.shift, v.root, v.tail, v.start + n, } } // String returns a string representation of the persistent vector. func (v *Vector) String() string { var items []string for i := uint64(0); i < v.count-uint64(v.start); i++ { items = append(items, fmt.Sprint(v.Get(int(i)))) } return fmt.Sprintf("[%s]", strings.Join(items, ", ")) } // Equal returns whether a vector has the same items as another vector. // The comparison between elements is done using reflect.DeepEqual. func Equal(v1, v2 *Vector) bool { return EqualFunc(v1, v2, reflect.DeepEqual) } // EqualFn is a function used to tell whether two elements in a vector are // the same. type EqualFn func(a, b interface{}) bool // EqualFunc returns whether a vector has the same items as another vector // using the given function to determine whether they're equal or not. func EqualFunc(v1, v2 *Vector, fn EqualFn) bool { len1 := v1.Count() len2 := v2.Count() if len1 != len2 { return false } for i := 0; i < len1; i++ { a := v1.Get(i) b := v2.Get(i) if !fn(a, b) { return false } } return true } const ( vectorBits uint32 = 5 vectorWidth uint32 = 1 << 5 vectorMask uint32 = (1 << 5) - 1 ) type node struct { values []interface{} } func (n *node) clone() *node { return n.cloneWithLen(len(n.values)) } func (n *node) cloneWithLen(length int) *node { newNode := &node{make([]interface{}, length)} copy(newNode.values, n.values) return newNode } var ( emptyNode = &node{make([]interface{}, vectorWidth)} emptyVector = &Vector{0, 5, emptyNode, &node{nil}, 0} ) // newPath creates a new path all the way through a branch inserting at the leftmost leaf. func newPath(n *node) *node { node := &node{make([]interface{}, vectorWidth)} node.values[0] = n return node }
vector.go
0.836955
0.653072
vector.go
starcoder
package reads import ( "bytes" "strconv" "github.com/influxdata/influxdb/v2/storage/reads/datatypes" ) // NodeVisitor can be called by Walk to traverse the Node hierarchy. // The Visit() function is called once per node. type NodeVisitor interface { Visit(*datatypes.Node) NodeVisitor } func WalkChildren(v NodeVisitor, node *datatypes.Node) { for _, n := range node.Children { WalkNode(v, n) } } func WalkNode(v NodeVisitor, node *datatypes.Node) { if v = v.Visit(node); v == nil { return } WalkChildren(v, node) } func PredicateToExprString(p *datatypes.Predicate) string { if p == nil { return "[none]" } var v predicateExpressionPrinter WalkNode(&v, p.Root) return v.Buffer.String() } type predicateExpressionPrinter struct { bytes.Buffer } func (v *predicateExpressionPrinter) Visit(n *datatypes.Node) NodeVisitor { switch n.NodeType { case datatypes.Node_TypeLogicalExpression: if len(n.Children) > 0 { var op string if n.GetLogical() == datatypes.Node_LogicalAnd { op = " AND " } else { op = " OR " } WalkNode(v, n.Children[0]) for _, e := range n.Children[1:] { v.Buffer.WriteString(op) WalkNode(v, e) } } return nil case datatypes.Node_TypeParenExpression: if len(n.Children) == 1 { v.Buffer.WriteString("( ") WalkNode(v, n.Children[0]) v.Buffer.WriteString(" )") } return nil case datatypes.Node_TypeComparisonExpression: WalkNode(v, n.Children[0]) v.Buffer.WriteByte(' ') switch n.GetComparison() { case datatypes.Node_ComparisonEqual: v.Buffer.WriteByte('=') case datatypes.Node_ComparisonNotEqual: v.Buffer.WriteString("!=") case datatypes.Node_ComparisonStartsWith: v.Buffer.WriteString("startsWith") case datatypes.Node_ComparisonRegex: v.Buffer.WriteString("=~") case datatypes.Node_ComparisonNotRegex: v.Buffer.WriteString("!~") case datatypes.Node_ComparisonLess: v.Buffer.WriteByte('<') case datatypes.Node_ComparisonLessEqual: v.Buffer.WriteString("<=") case datatypes.Node_ComparisonGreater: v.Buffer.WriteByte('>') case datatypes.Node_ComparisonGreaterEqual: v.Buffer.WriteString(">=") } v.Buffer.WriteByte(' ') WalkNode(v, n.Children[1]) return nil case datatypes.Node_TypeTagRef: v.Buffer.WriteByte('\'') v.Buffer.WriteString(n.GetTagRefValue()) v.Buffer.WriteByte('\'') return nil case datatypes.Node_TypeFieldRef: v.Buffer.WriteByte('$') return nil case datatypes.Node_TypeLiteral: switch val := n.Value.(type) { case *datatypes.Node_StringValue: v.Buffer.WriteString(strconv.Quote(val.StringValue)) case *datatypes.Node_RegexValue: v.Buffer.WriteByte('/') v.Buffer.WriteString(val.RegexValue) v.Buffer.WriteByte('/') case *datatypes.Node_IntegerValue: v.Buffer.WriteString(strconv.FormatInt(val.IntegerValue, 10)) case *datatypes.Node_UnsignedValue: v.Buffer.WriteString(strconv.FormatUint(val.UnsignedValue, 10)) case *datatypes.Node_FloatValue: v.Buffer.WriteString(strconv.FormatFloat(val.FloatValue, 'f', 10, 64)) case *datatypes.Node_BooleanValue: if val.BooleanValue { v.Buffer.WriteString("true") } else { v.Buffer.WriteString("false") } } return nil default: return v } }
storage/reads/predicate.go
0.549399
0.408277
predicate.go
starcoder
package main import ( "fmt" "sort" ) // measurements type AdvMeasure struct { medianEtaHonestThisRound float64 meanOpinionHonestLastRound float64 CurrentAdvOpinionForNode []bool CurrentNHonestForNode []int } // measure the mean honest opinion of the round func (sim *Sim) measureMeanHonestOpinionLastRound(advMeasure *AdvMeasure, round int) { sum := 0 for id := 0; id < sim.p.n_honest; id++ { if sim.node[id].decided { sum += btoi(sim.node[id].opinion[sim.node[id].TerminationRound]) } else { sum += btoi(sim.node[id].opinion[round]) } } advMeasure.meanOpinionHonestLastRound = float64(sum) / float64(sim.p.n_honest) } // measure the median etaHonest value honest opinion of the round func (sim *Sim) measureMedianEtaHonest(advMeasure *AdvMeasure, round int) { var etaHonest []float64 for id := 0; id < sim.p.n_honest; id++ { if !sim.node[id].decided { etaHonest = append(etaHonest, sim.node[id].etaHonest[round]) } else { // also include the opinion of finalized nodes into the median eta etaHonest = append(etaHonest, float64(btoi(sim.node[id].opinion[sim.node[id].TerminationRound]))) } } sort.Float64s(etaHonest) advMeasure.medianEtaHonestThisRound = GetUnsortedMedianOfSlice(etaHonest) } func GetUnsortedMedianOfSlice(s []float64) float64 { lens := len(s) if lens == 0 { fmt.Println("what should be returned in this case.?") wait() } if lens == 1 { return s[0] } // sort.Float64s(a) // sort the numbers if lens%2 == 1 { return s[lens/2] } else { return (s[lens/2-1] + s[lens/2]) / 2 } } // - - - sortable slice with a flag - - // s := NewSlice(1.2, 25.6, 3, 5, 4) // sort.Sort(s) type Slice struct { sort.Float64Slice idx []int flag []bool } func (s Slice) Swap(i, j int) { s.Float64Slice.Swap(i, j) s.idx[i], s.idx[j] = s.idx[j], s.idx[i] s.flag[i], s.flag[j] = s.flag[j], s.flag[i] } func NewSlice(flag []bool, n ...float64) *Slice { s := &Slice{Float64Slice: sort.Float64Slice(n), idx: make([]int, len(n)), flag: make([]bool, len(n))} for i := range s.idx { s.idx[i] = i s.flag[i] = flag[i] } return s } // evaluate the stored etas into a histogram that averages over all txs func (sim *Sim) evaluateEtaHisto() { for i := 0; i < sim.p.n_honest; i++ { sim.evaluateEtaHistoNode(sim.node[i]) } } func (sim *Sim) evaluateEtaHistoNode(node *Node) { for i, v := range node.eta { sim.result.EtaEvolution[i][etaHistoWhichColumn(v, sim.p)]++ } } func etaHistoWhichColumn(eta float64, p *Param) int { col := int(float64(p.k) * eta) return col }
measurements.go
0.52342
0.41561
measurements.go
starcoder
package tetris import ( "github.com/nsf/termbox-go" ) // A map from a point on a board to the color of that cell. type ColorMap map[Vector]termbox.Attribute // Returns whether a vector is a member of the color map. func (cm ColorMap) contains(v Vector) bool { _, ok := cm[v] return ok } // A Board represents the state of a tetris game board, including the current piece that is descending and the // blocks which already exist on the board. type Board struct { cells ColorMap currentPiece *Piece currentPosition Vector } // Create a new empty tetris board with no current piece. func newBoard() *Board { board := new(Board) board.cells = make(ColorMap) return board } // Finds whether the current piece is in collision (going over the edge, or overlapping existing occupied // blocks). This is useful for testing for collision when moving or rotating by speculatively making the move, // seeing if it collides, and moving back. func (board *Board) currentPieceInCollision() bool { for _, point := range board.currentPiece.instance() { attemptedPoint := point.plus(board.currentPosition) if attemptedPoint.x < 0 || attemptedPoint.x >= width || attemptedPoint.y < 0 || attemptedPoint.y >= height || board.cells.contains(attemptedPoint) { return true } } return false } // Moves the current piece to another location, if possible. The current piece is updated if this is // successful; otherwise, the piece is left unmoved. This method returns a boolean indicating whether the move // was successful. func (board *Board) moveIfPossible(translation Vector) bool { position := board.currentPosition board.currentPosition = board.currentPosition.plus(translation) if board.currentPieceInCollision() { board.currentPosition = position return false } return true } // Merge the blocks of the current piece into the game board and remove the current piece. func (board *Board) mergeCurrentPiece() { for _, point := range board.currentPiece.instance() { board.cells[point.plus(board.currentPosition)] = board.currentPiece.color } board.currentPiece = nil } // Check whether a horizontal row is complete. func (board *Board) rowComplete(y int) bool { for x := 0; x < width; x++ { if !board.cells.contains(Vector{x, y}) { return false } } return true } // Clear a single row and move every above cell down. func (board *Board) collapseRow(rowY int) { for y := rowY - 1; y >= 0; y-- { for x := 0; x < width; x++ { if color, ok := board.cells[Vector{x, y}]; ok { board.cells[Vector{x, y + 1}] = color } else { delete(board.cells, Vector{x, y + 1}) } } } // Clear the top row completely for x := 0; x < width; x++ { delete(board.cells, Vector{x, 0}) } } // Clear any complete rows and move the above blocks down. Returns the number of cleared rows. func (board *Board) clearRows() { rowsCleared := 0 y := height - 1 for y >= 0 { for board.rowComplete(y) { rowsCleared += 1 board.collapseRow(y) } y -= 1 } } // Find all completed rows. func (board *Board) clearedRows() []int { cleared := make([]int, 0) for y := 0; y < height; y++ { if board.rowComplete(y) { cleared = append(cleared, y) } } return cleared } // Finds the color of a particular board cell. It returns the background color if the cell is empty. func (board *Board) CellColor(position Vector) termbox.Attribute { if color, ok := board.cells[position]; ok { return color } if board.currentPiece == nil { return backgroundColor } for _, point := range board.currentPiece.instance() { if point.plus(board.currentPosition).equals(position) { return board.currentPiece.color } } return backgroundColor }
tetris/board.go
0.852107
0.652228
board.go
starcoder
package iso20022 // Set of elements providing information on the original amount and currency information. type AmountAndCurrencyExchange2 struct { // Identifies the amount of money to be moved between the debtor and creditor, before deduction of charges, expressed in the currency as ordered by the initiating party and provides currency exchange info in case the instructed amount and/or currency is/are different from the entry amount and/or currency. InstructedAmount *AmountAndCurrencyExchangeDetails1 `xml:"InstdAmt,omitempty"` // Amount of the underlying transaction. TransactionAmount *AmountAndCurrencyExchangeDetails1 `xml:"TxAmt,omitempty"` // Identifies the countervalue amount and provides currency exchange information. Either the counter amount quoted in an FX deal, or the result of the currency information applied to an instructed amount, before deduction of charges. CounterValueAmount *AmountAndCurrencyExchangeDetails1 `xml:"CntrValAmt,omitempty"` // Information on the amount of money, based on terms of corporate action event and balance of underlying securities, entitled to/from the account owner. // // Amount of money, based on terms of corporate action event and balance of underlying securities, entitled to/from the account owner. // In those situations, this amount may alternatively be called entitled amount. AnnouncedPostingAmount *AmountAndCurrencyExchangeDetails1 `xml:"AnncdPstngAmt,omitempty"` // Provides proprietary amount information. ProprietaryAmount []*AmountAndCurrencyExchangeDetails2 `xml:"PrtryAmt,omitempty"` } func (a *AmountAndCurrencyExchange2) AddInstructedAmount() *AmountAndCurrencyExchangeDetails1 { a.InstructedAmount = new(AmountAndCurrencyExchangeDetails1) return a.InstructedAmount } func (a *AmountAndCurrencyExchange2) AddTransactionAmount() *AmountAndCurrencyExchangeDetails1 { a.TransactionAmount = new(AmountAndCurrencyExchangeDetails1) return a.TransactionAmount } func (a *AmountAndCurrencyExchange2) AddCounterValueAmount() *AmountAndCurrencyExchangeDetails1 { a.CounterValueAmount = new(AmountAndCurrencyExchangeDetails1) return a.CounterValueAmount } func (a *AmountAndCurrencyExchange2) AddAnnouncedPostingAmount() *AmountAndCurrencyExchangeDetails1 { a.AnnouncedPostingAmount = new(AmountAndCurrencyExchangeDetails1) return a.AnnouncedPostingAmount } func (a *AmountAndCurrencyExchange2) AddProprietaryAmount() *AmountAndCurrencyExchangeDetails2 { newValue := new (AmountAndCurrencyExchangeDetails2) a.ProprietaryAmount = append(a.ProprietaryAmount, newValue) return newValue }
AmountAndCurrencyExchange2.go
0.77552
0.691054
AmountAndCurrencyExchange2.go
starcoder
package squares import ( "image" "image/color" "io" "math" svg "github.com/ajstarks/svgo" "github.com/taironas/tinygraphs/draw" ) //Grid builds an image with 6X6 quadrants of alternate colors. func Grid(m *image.RGBA, color1, color2 color.RGBA) { size := m.Bounds().Size() quad := size.X / 6 for x := 0; x < size.X; x++ { val := (x / quad) % 2 for y := 0; y < size.Y; y++ { val2 := (y / quad) % 2 q := (val + val2) % 2 if q == 0 { m.Set(x, y, color1) } else { m.Set(x, y, color2) } } } } // GridSVG builds an image with 6 by 6 quadrants of alternate colors. func GridSVG(w io.Writer, color1, color2 color.RGBA, size int) { canvas := svg.New(w) canvas.Start(size, size, draw.DefaultSvgAttributes()...) squares := 6 quadrantSize := size / squares colorMap := make(map[int]color.RGBA) for yQ := 0; yQ < squares; yQ++ { y := yQ * quadrantSize colorMap = make(map[int]color.RGBA) for xQ := 0; xQ < squares; xQ++ { x := xQ * quadrantSize if _, ok := colorMap[xQ]; !ok { if (xQ+yQ)%2 == 0 { colorMap[xQ] = color1 } else { colorMap[xQ] = color2 } } canvas.Rect(x, y, quadrantSize, quadrantSize, draw.FillFromRGBA(colorMap[xQ])) } } canvas.End() } // Image builds an image.RGBA type with 6 by 6 quadrants of alternate colors. func Image(m *image.RGBA, key string, colors []color.RGBA) { size := m.Bounds().Size() squares := 6 quad := size.X / squares middle := math.Ceil(float64(squares) / float64(2)) colorMap := make(map[int]color.RGBA) var currentYQuadrand = 0 for y := 0; y < size.Y; y++ { yQuadrant := y / quad if yQuadrant != currentYQuadrand { // when y quadrant changes, clear map colorMap = make(map[int]color.RGBA) currentYQuadrand = yQuadrant } for x := 0; x < size.X; x++ { xQuadrant := x / quad if _, ok := colorMap[xQuadrant]; !ok { if float64(xQuadrant) < middle { colorMap[xQuadrant] = draw.PickColor(key, colors, xQuadrant+3*yQuadrant) } else if xQuadrant < squares { colorMap[xQuadrant] = colorMap[squares-xQuadrant-1] } else { colorMap[xQuadrant] = colorMap[0] } } m.Set(x, y, colorMap[xQuadrant]) } } } // SVG builds an svg image with 6 by 6 quadrants of alternate colors. func SVG(w io.Writer, key string, colors []color.RGBA, size int) { canvas := svg.New(w) canvas.Start(size, size, draw.DefaultSvgAttributes()...) squares := 6 quadrantSize := size / squares middle := math.Ceil(float64(squares) / float64(2)) colorMap := make(map[int]color.RGBA) for yQ := 0; yQ < squares; yQ++ { y := yQ * quadrantSize colorMap = make(map[int]color.RGBA) for xQ := 0; xQ < squares; xQ++ { x := xQ * quadrantSize if _, ok := colorMap[xQ]; !ok { if float64(xQ) < middle { colorMap[xQ] = draw.PickColor(key, colors, xQ+3*yQ) } else if xQ < squares { colorMap[xQ] = colorMap[squares-xQ-1] } else { colorMap[xQ] = colorMap[0] } } canvas.Rect(x, y, quadrantSize, quadrantSize, draw.FillFromRGBA(colorMap[xQ])) } } canvas.End() }
draw/squares/squares.go
0.658088
0.481332
squares.go
starcoder
package gorbi import ( "fmt" "gonum.org/v1/gonum/floats" "gonum.org/v1/gonum/mat" "math" ) // Radial basis functions based on the euclidean distance func multiquadric(epsilon, r float64) float64 { return math.Sqrt(math.Pow(1.0/epsilon*r, 2.0) + 1) } // Radial basis interpolator type RBF struct { xi [][]float64 vi []float64 n int epsilon float64 function func(epsilon, r float64) float64 nodes *mat.Dense } // Constructor for the radial basis interpolator. func NewRBF(args [][]float64, values []float64) (RBF,error ){ // Find the number of points nPts := len(values) // Find the size of the hypercube containing all points, and set epsilon as the average length of the sides hypercubeDim := HypercubeDims(args) epsilon := math.Pow(floats.Prod(hypercubeDim)/float64(nPts), 1./float64(len(hypercubeDim))) // Set the radial basis function // TODO: Add more basis functions and a nice API for changing basis functions function := multiquadric // Calculate the euclidean distance between all points r := Cdist(args, args) // Evaluate the radial basis function for all points and assemble into A A := []float64{} for _, ri := range r { for _, r := range ri { A = append(A, function(epsilon, r)) } } // Assemble the coordinates and values into matrices and solve for the node values diMat := mat.NewDense(nPts, 1, values) AMat := mat.NewDense(nPts, nPts, A) nodes := mat.NewDense(nPts, 1, nil) err := nodes.Solve(AMat, diMat) if err != nil{ fmt.Println(err) return RBF{},err } return RBF{xi: args, vi: values, n: nPts, epsilon: epsilon, function: function, nodes: nodes, },nil } // Get the interpolated value at the given coordinate func (rbf *RBF) At(xs [][]float64) []float64 { nPts := len(xs) // Determine the distance between the current points and the points of the interpolated field r := Cdist(xs, rbf.xi) // Evaluate the basis functions for the radial distances A := []float64{} for _, ri := range r { for _, r := range ri { A = append(A, multiquadric(rbf.epsilon, r)) } } // Assemble into matrices and take the dot product of the values of the radial basis functions // and the node values AMat := mat.NewDense(nPts, rbf.n, A) vals := mat.NewDense(nPts, 1, nil) vals.Mul(AMat, rbf.nodes) return vals.RawMatrix().Data }
rbf.go
0.575349
0.564699
rbf.go
starcoder
package date import "fmt" import "time" // TimeOfDayRange specifies a duration within a day type TimeOfDayRange struct { Hour, Minute int Length time.Duration } func (tr TimeOfDayRange)IsInitialized() bool { return tr.Length > 0 } func (tr TimeOfDayRange)Start() time.Time { return time.Date(1970,0,0, tr.Hour,tr.Minute,0,0, time.UTC) } func (tr TimeOfDayRange)End() time.Time { return tr.Start().Add(tr.Length).Add(-1 * time.Second) } // Given an 'anchor day' t, find the start/end times of the TimeOfDay inside it. If the range // straddles midnight, then 'end' will come before 'start', and will be the end of the previous // day's range. Note that 't' *must* have a location defined, or this will panic(). func (tr TimeOfDayRange)AnchorInsideDay(t time.Time) (time.Time,time.Time) { s := time.Date(t.Year(), t.Month(), t.Day(), tr.Hour,tr.Minute,0,0, t.Location()) e := s.Add(tr.Length).Add(-1 * time.Second) if e.Hour() < s.Hour() { // We have straddled midnight ! End will be in tomorrow; bring back e = e.AddDate(0,0,-1) } return s,e } func ParseTimeOfDay(start string, length string) (TimeOfDayRange, error) { ret := TimeOfDayRange{} if t,err := time.Parse("15:04", start); err != nil { return ret, fmt.Errorf("ParseTimeOfDay(%s,%s) start: %v", start, length, err) } else if d,err := time.ParseDuration(length); err != nil { return ret, fmt.Errorf("ParseTimeOfDay(%s,%s) length: %v", start, length, err) } else if d > (23 * time.Hour) { return ret, fmt.Errorf("ParseTimeOfDay(%s,%s) length too long (23h max)", start, length) } else { return TimeOfDayRange{Hour:t.Hour(), Minute:t.Minute(), Length:d}, nil } } func (tr TimeOfDayRange)String() string { return fmt.Sprintf("%02d:%02d+%s", tr.Hour, tr.Minute, tr.Length) } func (tr TimeOfDayRange)Contains(t time.Time) bool { s,e := tr.AnchorInsideDay(t) if e.Hour() < s.Hour() { // We straddle midnight, so compare against two ranges: [s,23:59] and [00:00,e] return t.Before(e) || (t.Equal(s) || t.After(s)) } // The range doesn't straddle midnight, so t must be in the range [s,e] return (t.Equal(s) || t.After(s)) && t.Before(e) } func (tr TimeOfDayRange)Overlaps(s,e time.Time) bool { // Implement me. return false }
date/timeofday.go
0.761361
0.547646
timeofday.go
starcoder
package types import ( "fmt" "math" ) // Grid outlines the default word search grid. type Grid struct { Rows []*Row // Rows } /* BEGIN EXPORTED METHODS */ // NewGrid initializes a new grid with a given width and height. func NewGrid(width, height uint64) *Grid { grid := &Grid{ Rows: []*Row{}, // Set rows } // Return init grid for i := uint64(0); i < height; i++ { // Make rows grid.Rows = append(grid.Rows, NewRow("")) // Initialize row } return grid // Return grid } // FindString finds the position of all requested chars in the given grid. func (grid *Grid) FindString(s string) ([]uint64, []uint64) { var xCoordinates []uint64 // Init x coords buffer var yCoordinates []uint64 // Init y coords buffer n := 0 // Init iterator findCoords: for i, char := range s { // Iterate through chars fmt.Println(n) x, y := grid.GetCharPos(char, n) // Get position if x == -1 || y == -1 { // Check invalid coords return []uint64{}, []uint64{} // Return null } if i != 0 { // Check is not first char if math.Abs(float64(xCoordinates[i-1])-float64(x)) > 1 { // Check invalid selection xCoordinates = xCoordinates[:0] // Reset slice yCoordinates = yCoordinates[:0] // Reset slice n++ // Increment goto findCoords // Reset iteration } else if math.Abs(float64(yCoordinates[i-1])-float64(y)) > 1 { // Check invalid selection xCoordinates = xCoordinates[:0] // Reset slice yCoordinates = yCoordinates[:0] // Reset slice n++ // Increment goto findCoords // Reset iteration } } xCoordinates = append(xCoordinates, uint64(x)) // Append x yCoordinates = append(yCoordinates, uint64(y)) // Append y } return xCoordinates, yCoordinates // Return coordinates } // GetCharPos gets the position of a char in the given grid. func (grid *Grid) GetCharPos(c rune, n int) (int64, int64) { i := 0 // Init iterator for y, row := range grid.Rows { // Iterate through rows for x, char := range row.Letters { // Iterate through row letters if char == c { // Check matching char if i != n { // Check invalid match i++ // Increment iterator continue // Continue } return int64(x), int64(y) // Return coords } } } return 0, 0 // Invalid } // GetRow gets a reference to the row at iterator i. func (grid *Grid) GetRow(i uint64) *Row { return grid.Rows[i] // Return row } /* END EXPORTED METHODS */ /* BEGIN INTERNAL METHODS */ func makeString(len uint64) string { var str string // Init string buffer for i := uint64(0); i < len; i++ { // Make string str = str + "0" // Append empty string } return str // Retrun string } /* END INTERNAL METHODS */
types/grid.go
0.68721
0.52476
grid.go
starcoder
package fixture const ( // Simple schema with definitions and refs TestSchemaWithDefinitions = ` { "definitions": { "movie": { "type": "object", "required": ["id", "name"], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "year": { "type": "integer" }, "actor": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } } }, "categories": { "$ref": "#/definitions/categories" } } }, "categories": { "type": "array", "items": { "type": "string" } } } } ` // Schema without definitions TestSchemaDirect = ` { "type": "object", "required": ["id", "name"], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "year": { "type": "integer" }, "actor": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } } }, "categories": { "$ref": "#/definitions/categories" } } } ` // Schema with nested definitions TestSchemaWithNestedDefinitions = ` { "definitions": { "movie": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } }, "definitions": { "actor": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } } } } } } } ` // All possible primitive types of a schema TestSchemaPrimitiveTypes = ` { "definitions": { "null": { "type": "null" }, "boolean": { "type": "boolean" }, "object": { "type": "object" }, "array": { "type": "array" }, "number": { "type": "number" }, "integer": { "type": "integer" }, "string": { "type": "string" } } } ` // Schema with validation: required TestSchemaRequiredValidation = ` { "definitions": { "movie": { "type": "object", "required": ["id", "actors"], "properties": { "id": { "type": "string" }, "actors": { "type": "array", "items": { "$ref": "#/definitions/actor" } } } }, "actor": { "type": "object", "required": ["name", "location"], "properties": { "name": { "type": "string" }, "location": { "$ref": "#/definitions/location" } } }, "location": { "type": "object", "required": ["name"], "properties": { "name": { "type": "string" } } } } } ` // Schema with array of objects TestSchemaWithArrayOfObjects = ` { "definitions": { "movies": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "year": { "type": "integer" } } } } } } ` )
fixture/fixture.go
0.577972
0.441191
fixture.go
starcoder
package stats import ( "container/heap" "math" "math/rand" "sort" "time" ) type Histogram struct { decay float64 horizon time.Time resample time.Duration sample sample size int start time.Time values []int64 } func (h *Histogram) Len() int { return len(h.sample) } func (h *Histogram) Mean() float64 { if len(h.sample) == 0 { return 0 } var total int64 for _, i := range h.sample { total += i.value } return float64(total) / float64(len(h.sample)) } func (h *Histogram) Percentile(p float64) float64 { slen := len(h.sample) if slen == 0 { return 0 } if slen == 1 { return float64(h.sample[0].value) } l := h.values[:slen] for idx, i := range h.sample { l[idx] = i.value } sort.Sort(values(l)) pos := p * float64(slen-1) ceil := math.Ceil(pos) floor := math.Floor(pos) if ceil == floor { return float64(l[int(pos)]) } return float64(l[int(floor)])*(ceil-pos) + float64(l[int(ceil)])*(pos-floor) } func (h *Histogram) StdDev() float64 { return math.Sqrt(h.Variance()) } // Adapted from the various ports of the Coda Hale Metrics library which // reference the paper "Forward Decay: A Practical Time Decay Model for // Streaming Systems". func (h *Histogram) Update(t time.Time, v int64) { if len(h.sample) == h.size { heap.Pop(&h.sample) } heap.Push(&h.sample, elem{ pos: math.Exp(t.Sub(h.start).Seconds()*h.decay) / rand.Float64(), value: v, }) if t.After(h.horizon) { diff := math.Exp(t.Sub(h.start).Seconds() * -h.decay) h.start = t h.horizon = t.Add(h.resample) for _, i := range h.sample { i.pos *= diff } } } func (h *Histogram) Variance() float64 { sample := h.sample slen := float64(len(sample)) if slen == 0 { return 0 } var ( diff float64 total int64 ) for _, i := range sample { total += i.value } mean := float64(total) / slen ft := 0.0 for _, i := range sample { diff = mean - float64(i.value) ft += diff * diff } return ft / slen } type elem struct { pos float64 value int64 } type sample []elem func (s sample) Len() int { return len(s) } func (s sample) Less(i, j int) bool { return s[i].pos < s[j].pos } func (s *sample) Push(v interface{}) { *s = append(*s, v.(elem)) } func (s sample) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s *sample) Pop() interface{} { old := *s n := len(old) x := old[n-1] *s = old[0 : n-1] return x } type values []int64 func (v values) Len() int { return len(v) } func (v values) Less(i, j int) bool { return v[i] < v[j] } func (v values) Swap(i, j int) { v[i], v[j] = v[j], v[i] } func New(size int, decay float64, resample time.Duration) *Histogram { start := time.Now().UTC() return &Histogram{ decay: decay, horizon: start.Add(resample), resample: resample, sample: make(sample, 0, size), size: size, start: start, values: make([]int64, 0, size), } }
pkg/stats/stats.go
0.629319
0.445349
stats.go
starcoder
package steps import ( "bytes" "fmt" "log" "math" "sort" "strconv" "time" "github.com/bitflow-stream/go-bitflow/bitflow" "github.com/bitflow-stream/go-bitflow/script/reg" ) func RegisterLoggingSteps(b reg.ProcessorRegistry) { b.RegisterStep("print_header", print_header, "Print every changing header to the log") b.RegisterStep("print_tags", print_tags, "When done processing, print every encountered value of the given tag"). Required("tag", reg.String()) b.RegisterStep("count_tags", count_tags, "When done processing, print the number of times every value of the given tag was encountered"). Required("tag", reg.String()) b.RegisterStep("print_timerange", print_time_range, "When done processing, print the first and last encountered timestamp") b.RegisterStep("histogram", print_timeline, "When done processing, print a timeline showing a rudimentary histogram of the number of samples"). Optional("buckets", reg.Int(), 10) b.RegisterStep("count_invalid", count_invalid, "When done processing, print the number of invalid metric values and samples containing such values (NaN, -/+ infinity, ...)") b.RegisterStep("print_common_metrics", print_common_metrics, "When done processing, print the metrics that occurred in all processed headers") } func print_header(p *bitflow.SamplePipeline, _ map[string]interface{}) error { var checker bitflow.HeaderChecker numSamples := 0 p.Add(&bitflow.SimpleProcessor{ Description: "header printer", Process: func(sample *bitflow.Sample, header *bitflow.Header) (*bitflow.Sample, *bitflow.Header, error) { if checker.HeaderChanged(header) { if checker.LastHeader != nil { log.Println("Samples after last header:", numSamples) } log.Println(header) numSamples = 0 } numSamples++ return sample, header, nil }, OnClose: func() { log.Println("Samples after last header:", numSamples) }, }) return nil } type UniqueTagPrinter struct { bitflow.NoopProcessor Tag string Count bool values map[string]int } func NewUniqueTagPrinter(tag string) *UniqueTagPrinter { return &UniqueTagPrinter{ Tag: tag, Count: false, values: make(map[string]int), } } func NewUniqueTagCounter(tag string) *UniqueTagPrinter { return &UniqueTagPrinter{ Tag: tag, Count: true, values: make(map[string]int), } } func (printer *UniqueTagPrinter) Sample(sample *bitflow.Sample, header *bitflow.Header) error { val := sample.Tag(printer.Tag) if printer.Count { printer.values[val] = printer.values[val] + 1 } else { printer.values[val] = 1 } return printer.NoopProcessor.Sample(sample, header) } func (printer *UniqueTagPrinter) Close() { total := 0 keys := make([]string, 0, len(printer.values)) for label := range printer.values { keys = append(keys, label) } sort.Strings(keys) log.Println("Now outputting results of", printer) for _, label := range keys { // Print to stdout instead of logger if printer.Count { count := printer.values[label] if label == "" { label = "(missing value)" } fmt.Println(label, count) total += count } else if label != "" { fmt.Println(label) } } if printer.Count { fmt.Println("Total", total) } printer.NoopProcessor.Close() } func (printer *UniqueTagPrinter) String() string { var res string if printer.Count { res = "Count" } else { res = "Print" } return res + " unique values of tag '" + printer.Tag + "'" } func print_tags(p *bitflow.SamplePipeline, params map[string]interface{}) error { p.Add(NewUniqueTagPrinter(params["tag"].(string))) return nil } func count_tags(p *bitflow.SamplePipeline, params map[string]interface{}) error { p.Add(NewUniqueTagCounter(params["tag"].(string))) return nil } func print_time_range(p *bitflow.SamplePipeline, _ map[string]interface{}) error { var ( from time.Time to time.Time count int ) p.Add(&bitflow.SimpleProcessor{ Description: "Print time range", Process: func(sample *bitflow.Sample, header *bitflow.Header) (*bitflow.Sample, *bitflow.Header, error) { count++ t := sample.Time if from.IsZero() || to.IsZero() { from = t to = t } else if t.Before(from) { from = t } else if t.After(to) { to = t } return sample, header, nil }, OnClose: func() { format := "02.01.2006 15:04:05" duration := to.Sub(from) / time.Millisecond * time.Millisecond // Round log.Printf("Time range of %v samples: %v - %v (%v)", count, from.Format(format), to.Format(format), duration) }, }) return nil } func print_timeline(p *bitflow.SamplePipeline, params map[string]interface{}) error { numBuckets := params["buckets"].(int) if numBuckets <= 0 { numBuckets = 1 } var times []time.Time p.Add(&bitflow.SimpleProcessor{ Description: fmt.Sprintf("Print timeline (len %v)", numBuckets), Process: func(sample *bitflow.Sample, header *bitflow.Header) (*bitflow.Sample, *bitflow.Header, error) { times = append(times, sample.Time) return sample, header, nil }, OnClose: func() { var from, to time.Time for _, t := range times { if from.IsZero() || to.IsZero() { from = t to = t } else if t.Before(from) { from = t } else if t.After(to) { to = t } } duration := to.Sub(from) bucketDuration := duration / time.Duration(numBuckets) buckets := make([]int, numBuckets) bucketEnds := make([]time.Time, numBuckets) for i := 0; i < numBuckets-1; i++ { bucketEnds[i] = from.Add(time.Duration(i+1) * bucketDuration) } bucketEnds[numBuckets-1] = to // No rounding error for _, t := range times { index := sort.Search(len(buckets), func(n int) bool { return !t.After(bucketEnds[n]) }) buckets[index]++ } largestBuffer := 0 for _, num := range buckets { if num > largestBuffer { largestBuffer = num } } var timeline bytes.Buffer for _, bucketSize := range buckets { if bucketSize == 0 { timeline.WriteRune('-') } else { num := int(math.Ceil(float64(bucketSize)/float64(largestBuffer)*10)) - 1 // [0..9] timeline.WriteString(strconv.Itoa(num)) } } log.Println("[Timeline]: Start:", from) log.Println("[Timeline]: End:", to) log.Println("[Timeline]: Duration:", duration) log.Println("[Timeline]: One bucket:", bucketDuration) log.Println("[Timeline]:", timeline.String()) }, }) return nil } func count_invalid(p *bitflow.SamplePipeline, _ map[string]interface{}) error { var ( invalidSamples int totalSamples int invalidValues int totalValues int ) p.Add(&bitflow.SimpleProcessor{ Description: "Invalid values counter", Process: func(sample *bitflow.Sample, header *bitflow.Header) (*bitflow.Sample, *bitflow.Header, error) { sampleValid := true for _, val := range sample.Values { totalValues += 1 if !IsValidNumber(float64(val)) { invalidValues += 1 sampleValid = false } } totalSamples += 1 if !sampleValid { invalidSamples += 1 } return sample, header, nil }, OnClose: func() { log.Printf("Invalid numbers: %v of %v, in %v of %v samples", invalidValues, totalValues, invalidSamples, totalSamples) }, }) return nil } func print_common_metrics(p *bitflow.SamplePipeline, _ map[string]interface{}) error { var ( checker bitflow.HeaderChecker common map[string]bool num int ) p.Add(&bitflow.SimpleProcessor{ Description: "Common metrics printer", Process: func(sample *bitflow.Sample, header *bitflow.Header) (*bitflow.Sample, *bitflow.Header, error) { if checker.HeaderChanged(header) { num++ if common == nil { common = make(map[string]bool) for _, field := range header.Fields { common[field] = true } } else { incoming := make(map[string]bool) for _, field := range header.Fields { incoming[field] = true } for field := range common { if !incoming[field] { delete(common, field) } } } } return sample, header, nil }, OnClose: func() { fields := make([]string, 0, len(common)) for field := range common { fields = append(fields, field) } sort.Strings(fields) log.Printf("%v common metrics in %v headers: %v", len(fields), num, fields) }, }) return nil }
steps/logging.go
0.575707
0.408808
logging.go
starcoder
package svgparser import ( "fmt" "gioui.org/f32" "strings" ) // This file defines the basic path structure // Operation groups the different SVG commands type Operation interface { // SVG text representation of the command fmt.Stringer // add itself on the driver `d`, after aplying the transform `M` drawTo(d Drawer, M Matrix2D) } // OpMoveTo moves the current point. type OpMoveTo f32.Point // OpLineTo draws a line from the current point, // and updates it. type OpLineTo f32.Point // OpQuadTo draws a quadratic Bezier curve from the current point, // and updates it. type OpQuadTo [2]f32.Point // OpCubicTo draws a cubic Bezier curve from the current point, // and updates it. type OpCubicTo [3]f32.Point // OpClose close the current path. type OpClose struct{} // starts a new path at the given point. func (op OpMoveTo) drawTo(d Drawer, M Matrix2D) { d.Stop(false) // implicit close if currently in path. d.Start(M.TFixed(f32.Point(op))) } // draw a line func (op OpLineTo) drawTo(d Drawer, M Matrix2D) { d.Line(M.TFixed(f32.Point(op))) } // draw a quadratic bezier curve func (op OpQuadTo) drawTo(d Drawer, M Matrix2D) { d.QuadBezier(M.TFixed(op[0]), M.TFixed(op[1])) } // draw a cubic bezier curve func (op OpCubicTo) drawTo(d Drawer, M Matrix2D) { d.CubeBezier(M.TFixed(op[0]), M.TFixed(op[1]), M.TFixed(op[2])) } func (op OpClose) drawTo(d Drawer, _ Matrix2D) { d.Stop(true) } func (op OpMoveTo) String() string { return fmt.Sprintf("M%4.3f,%4.3f", float32(op.X)/64, float32(op.Y)/64) } func (op OpLineTo) String() string { return fmt.Sprintf("L%4.3f,%4.3f", float32(op.X)/64, float32(op.Y)/64) } func (op OpQuadTo) String() string { return fmt.Sprintf("Q%4.3f,%4.3f,%4.3f,%4.3f", float32(op[0].X)/64, float32(op[0].Y)/64, float32(op[1].X)/64, float32(op[1].Y)/64) } func (op OpCubicTo) String() string { return "C" + fmt.Sprintf("C%4.3f,%4.3f,%4.3f,%4.3f,%4.3f,%4.3f", float32(op[0].X)/64, float32(op[0].Y)/64, float32(op[1].X)/64, float32(op[1].Y)/64, float32(op[2].X)/64, float32(op[2].Y)/64) } func (op OpClose) String() string { return "Z" } // Path describes a sequence of basic SVG operations, which should not be nil // Higher-level shapes may be reduced to a path. type Path []Operation // ToSVGPath returns a string representation of the path func (p Path) ToSVGPath() string { chunks := make([]string, len(p)) for i, op := range p { chunks[i] = op.String() } return strings.Join(chunks, " ") } // String returns a readable representation of a Path. func (p Path) String() string { return p.ToSVGPath() } // Clear zeros the path slice func (p *Path) Clear() { *p = (*p)[:0] } // Start starts a new curve at the given point. func (p *Path) Start(a f32.Point) { *p = append(*p, OpMoveTo(a)) } // Line adds a linear segment to the current curve. func (p *Path) Line(b f32.Point) { *p = append(*p, OpLineTo(b)) } // QuadBezier adds a quadratic segment to the current curve. func (p *Path) QuadBezier(b, c f32.Point) { *p = append(*p, OpQuadTo{b, c}) } // CubeBezier adds a cubic segment to the current curve. func (p *Path) CubeBezier(b, c, d f32.Point) { *p = append(*p, OpCubicTo{b, c, d}) } // Stop joins the ends of the path func (p *Path) Stop(closeLoop bool) { if closeLoop { *p = append(*p, OpClose{}) } }
internal/svgparser/path.go
0.78535
0.598077
path.go
starcoder
package exp // AndExpression combines a series of sub-expressions using AND logic type AndExpression []Expression // And combines one or more expression parameters into an AndExpression func And(expressions ...Expression) AndExpression { return AndExpression(expressions) } func (andExpression AndExpression) And(exp Expression) Expression { switch value := exp.(type) { case EmptyExpression: return andExpression case AndExpression: return append(andExpression, value...) case Predicate: return append(andExpression, value) default: return Or(andExpression, value) } } func (andExpression AndExpression) Or(exp Expression) Expression { if _, ok := exp.(EmptyExpression); ok { return andExpression } return Or(andExpression, exp) } func (andExpression AndExpression) AndEqual(name string, value interface{}) Expression { return andExpression.And(New(name, OperatorEqual, value)) } func (andExpression AndExpression) AndNotEqual(name string, value interface{}) Expression { return andExpression.And(New(name, OperatorNotEqual, value)) } func (andExpression AndExpression) AndLessThan(name string, value interface{}) Expression { return andExpression.And(New(name, OperatorLessThan, value)) } func (andExpression AndExpression) AndLessOrEqual(name string, value interface{}) Expression { return andExpression.And(New(name, OperatorLessOrEqual, value)) } func (andExpression AndExpression) AndGreaterThan(name string, value interface{}) Expression { return andExpression.And(New(name, OperatorGreaterThan, value)) } func (andExpression AndExpression) AndGreaterOrEqual(name string, value interface{}) Expression { return andExpression.And(New(name, OperatorGreaterOrEqual, value)) } // Match implements the Expression interface. It loops through all sub-expressions and returns TRUE if all of them match func (andExpression AndExpression) Match(fn MatcherFunc) bool { for _, expression := range andExpression { if !expression.Match(fn) { return false } } return true }
and.go
0.802826
0.591192
and.go
starcoder
package graphql_models import ( "fmt" "io" "strconv" boilergql "github.com/web-ridge/utils-go/boilergql/v3" ) type Node interface { IsNode() } type BooleanFilter struct { EqualTo *bool `json:"equalTo"` NotEqualTo *bool `json:"notEqualTo"` } type FloatFilter struct { EqualTo *float64 `json:"equalTo"` NotEqualTo *float64 `json:"notEqualTo"` LessThan *float64 `json:"lessThan"` LessThanOrEqualTo *float64 `json:"lessThanOrEqualTo"` MoreThan *float64 `json:"moreThan"` MoreThanOrEqualTo *float64 `json:"moreThanOrEqualTo"` In []float64 `json:"in"` NotIn []float64 `json:"notIn"` } type IDFilter struct { EqualTo *string `json:"equalTo"` NotEqualTo *string `json:"notEqualTo"` In []string `json:"in"` NotIn []string `json:"notIn"` } type IntFilter struct { EqualTo *int `json:"equalTo"` NotEqualTo *int `json:"notEqualTo"` LessThan *int `json:"lessThan"` LessThanOrEqualTo *int `json:"lessThanOrEqualTo"` MoreThan *int `json:"moreThan"` MoreThanOrEqualTo *int `json:"moreThanOrEqualTo"` In []int `json:"in"` NotIn []int `json:"notIn"` } type PageInfo struct { HasNextPage bool `json:"hasNextPage"` HasPreviousPage bool `json:"hasPreviousPage"` StartCursor *string `json:"startCursor"` EndCursor *string `json:"endCursor"` } type StringFilter struct { EqualTo *string `json:"equalTo"` NotEqualTo *string `json:"notEqualTo"` In []string `json:"in"` NotIn []string `json:"notIn"` StartWith *string `json:"startWith"` NotStartWith *string `json:"notStartWith"` EndWith *string `json:"endWith"` NotEndWith *string `json:"notEndWith"` Contain *string `json:"contain"` NotContain *string `json:"notContain"` StartWithStrict *string `json:"startWithStrict"` NotStartWithStrict *string `json:"notStartWithStrict"` EndWithStrict *string `json:"endWithStrict"` NotEndWithStrict *string `json:"notEndWithStrict"` ContainStrict *string `json:"containStrict"` NotContainStrict *string `json:"notContainStrict"` } type User struct { ID string `json:"id"` FirstName string `json:"firstName"` LastName string `json:"lastName"` Age int `json:"age"` Email *string `json:"email"` } func (User) IsNode() {} type UserConnection struct { Edges []*UserEdge `json:"edges"` PageInfo *PageInfo `json:"pageInfo"` } type UserEdge struct { Cursor string `json:"cursor"` Node *User `json:"node"` } type UserFilter struct { Search *string `json:"search"` Where *UserWhere `json:"where"` } type UserOrdering struct { Sort UserSort `json:"sort"` Direction boilergql.SortDirection `json:"direction"` } type UserWhere struct { ID *IDFilter `json:"id"` FirstName *StringFilter `json:"firstName"` LastName *StringFilter `json:"lastName"` Age *IntFilter `json:"age"` Email *StringFilter `json:"email"` Or *UserWhere `json:"or"` And *UserWhere `json:"and"` } type UserSort string const ( UserSortID UserSort = "ID" UserSortFirstName UserSort = "FIRST_NAME" UserSortLastName UserSort = "LAST_NAME" UserSortAge UserSort = "AGE" UserSortEmail UserSort = "EMAIL" ) var AllUserSort = []UserSort{ UserSortID, UserSortFirstName, UserSortLastName, UserSortAge, UserSortEmail, } func (e UserSort) IsValid() bool { switch e { case UserSortID, UserSortFirstName, UserSortLastName, UserSortAge, UserSortEmail: return true } return false } func (e UserSort) String() string { return string(e) } func (e *UserSort) UnmarshalGQL(v interface{}) error { str, ok := v.(string) if !ok { return fmt.Errorf("enums must be strings") } *e = UserSort(str) if !e.IsValid() { return fmt.Errorf("%s is not a valid UserSort", str) } return nil } func (e UserSort) MarshalGQL(w io.Writer) { fmt.Fprint(w, strconv.Quote(e.String())) }
issue-6-edges-connections/graphql_models/generated_models.go
0.632049
0.427217
generated_models.go
starcoder
package require2 import ( "errors" "reflect" "runtime" "strconv" "strings" "testing" "golang.org/x/exp/constraints" ) func Equal[T comparable](t *testing.T, expected T, actual T) { if expected != actual { fatalf(t, "assertion failed: %#v == %#v", expected, actual) } } func DeepEqual[T any](t *testing.T, a T, b T) { if !reflect.DeepEqual(a, b) { fatalf(t, "assertion failed: reflect.DeepEqual(%#v, %#v)", a, b) } } func Equalf[T comparable](t *testing.T, expected T, actual T, s string, fmtArgs ...any) { if expected != actual { fatalf(t, "assertion failed: %#v == %#v\n"+s, append([]any{expected, actual}, fmtArgs...)...) } } func SlicesEqual[T comparable](t *testing.T, expected []T, actual []T) { n := len(expected) if len(actual) < n { n = len(actual) } for i := 0; i < n; i++ { if expected[i] != actual[i] { fatalf(t, "differ at index %d: %#v != %#v", i, expected[i], actual[i]) } } if len(expected) != len(actual) { fatalf(t, "lengths differ: %d != %d", len(expected), len(actual)) } } func Nil[T any](t *testing.T, a *T) { if a != nil { t.Fatal("expected nil") } } func NotNil[T any](t *testing.T, a *T) { if a == nil { t.Fatal("expected not nil") } } func NotNilf[T any](t *testing.T, a *T, f string, fmtArgs ...any) { if a == nil { fatalf(t, "expected not nil\n"+f, fmtArgs...) } } func NoError(t *testing.T, err error) { if err != nil { fatalf(t, "expected no error, got %#v", err) } } func Error(t *testing.T, err error) { if err == nil { fatalf(t, "expected %T (%s), got no error", err, err) } } func ErrorIs(t *testing.T, err error, match error) { if !errors.Is(err, match) { fatalf(t, "expected %T (%s), got %#v", match, match, err) } } func Greater[T constraints.Ordered](t *testing.T, a T, b T) { if !(a > b) { fatalf(t, "assertion failed: %#v > %#v", a, b) } } func GreaterOrEqual[T constraints.Ordered](t *testing.T, a T, b T) { if !(a >= b) { fatalf(t, "assertion failed: %#v >= %#v", a, b) } } func Less[T constraints.Ordered](t *testing.T, a T, b T) { if !(a < b) { fatalf(t, "assertion failed: %#v < %#v", a, b) } } func LessOrEqual[T constraints.Ordered](t *testing.T, a T, b T) { if !(a <= b) { fatalf(t, "assertion failed: %#v <= %#v", a, b) } } func InDelta[T constraints.Float](t *testing.T, actual T, expected T, delta T) { diff := actual - expected if diff < 0 { diff = -diff } if diff > delta { fatalf(t, "expected %#v to be within %#v of %#v, actually %#v", actual, delta, expected, diff) } } func True(t *testing.T, b bool) { if !b { fatalf(t, "expected true") } } func Truef(t *testing.T, b bool, s string, fmtArgs ...any) { if !b { fatalf(t, "expected true\n"+s, fmtArgs...) } } func ElementsMatch[T comparable](t *testing.T, a []T, b []T) { aSet := make(map[T]struct{}, len(a)) for _, ai := range a { aSet[ai] = struct{}{} } bSet := make(map[T]struct{}, len(b)) for _, bi := range b { bSet[bi] = struct{}{} } for ai := range aSet { _, ok := bSet[ai] if !ok { fatalf(t, "%#v appears in a but not in b", ai) } } for bi := range bSet { _, ok := aSet[bi] if !ok { fatalf(t, "%#v appears in b but not in a", bi) } } } func fatalf(t *testing.T, s string, fmtArgs ...any) { var buf [64]uintptr var ptrs []uintptr skip := 2 for { n := runtime.Callers(skip, buf[:]) ptrs = append(ptrs, buf[:n]...) if n < len(buf) { break } skip += n } var sb strings.Builder frames := runtime.CallersFrames(ptrs) for { frame, more := frames.Next() _, _ = sb.WriteString(frame.Function) _, _ = sb.WriteString("(...)\n ") _, _ = sb.WriteString(frame.File) _, _ = sb.WriteString(":") _, _ = sb.WriteString(strconv.Itoa(frame.Line)) _, _ = sb.WriteString("\n") if !more { break } } t.Fatalf(s+"\n\n%s", append(fmtArgs, sb.String())...) }
internal/require2/require.go
0.575469
0.629604
require.go
starcoder
package coins import "sort" const maxUint = ^uint(0) const maxInt = int(maxUint >> 1) // Coin is a coin with a value and quantity type Coin struct { value int Quantity int } // Coins is a slice of Coins type Coins []Coin // ByValue implements sort.Interface for Coins based on Coin.value type ByValue Coins func (a ByValue) Len() int { return len(a) } func (a ByValue) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a ByValue) Less(i, j int) bool { return a[i].value < a[j].value } // ByQuantity implements sort.Interface for Coins based on Coin.Quantity type ByQuantity Coins func (a ByQuantity) Len() int { return len(a) } func (a ByQuantity) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a ByQuantity) Less(i, j int) bool { return a[i].Quantity < a[j].Quantity } // Equals tests equality of two Coin instances func (a Coin) Equals(b Coin) bool { return a.value == b.value && a.Quantity == b.Quantity } // Equals tests equality of two sets of Coins. Order matters! func (a Coins) Equals(b Coins) bool { if len(a) != len(b) { return false } for i := range a { if !(a[i].value == b[i].value && a[i].Quantity == b[i].Quantity) { return false } } return true } // Minimum takes an amount and a set of Coins (quantities ignored) and returns // the Coins with minimum total quantity that sum to amount. func Minimum(amount int, coins Coins) (Coins, int) { m := make(map[int]int) s := make(map[int]int) m[0] = 0 for n := 1; n <= amount; n++ { var coin int min := maxInt for i, c := range coins { if c.value <= n && (1+m[n-c.value]) < min { if m[n-c.value] != maxInt { min = 1 + m[n-c.value] } coin = i } } m[n] = min s[n] = coin } for _, c := range coins { c.Quantity = 0 } count := 0 for amount > 0 { i := s[amount] coins[i].Quantity++ count++ amount -= coins[i].value } return coins, count } // Combinations takes an amount and a slice of Coins and returns the number of // unique combinations of those coins that sum the given amount. func Combinations(amount int, coins Coins) int { // Sort coins by value sort.Sort(ByValue(coins)) // Map of amount to combination count C := make(map[int]int) C[0] = 1 // Iterate over all coins, rom least to greatest value, checking // combination counts for all possible amounts (C[amt]) for the given // coin (i.e. those greater than or equal to the coin's value) and less // than the given amount. For any C[amt] and coin, C[amt-coin.value] // represents the count of coin combinations necessary to get to the // amount one coin.value less than amount (i.e. the previous step). for _, coin := range coins { for amt := coin.value; amt <= amount; amt++ { C[amt] += C[amt-coin.value] } } // Return the combination count at the given amount return C[amount] }
coins/coins.go
0.806091
0.515803
coins.go
starcoder
package lib import ( "fmt" "math" ) // Sum To sum all values of int slice func Sum(values []int) (count int) { for _, v := range values { count += v } return } // Mult To sum all values of int slice func Mult(values []int) (count int) { count = 1 for _, v := range values { count *= v } return } // Unpack To unpack a slice of two elements func Unpack(values []string) (string, string) { if len(values) != 2 { fmt.Println("Unpack only accept len=2 this will fail...") return "", "" } return values[0], values[1] } // UnpackInt To unpack a slice of two elements and convert them to int func UnpackInt(values []string) (int, int) { value1, value2 := Unpack(values) return ToInt(value1), ToInt(value2) } // ToIntSlice Convert a slice of string to a slice of int func ToIntSlice(values []string) []int { result := make([]int, len(values)) for i, v := range values { result[i] = ToInt(v) } return result } func Min(values []int) (min int) { min, _ = MinMax(values) return } func Max(values []int) (max int) { _, max = MinMax(values) return } func MinMax(values []int) (min int, max int) { min = math.MaxInt for _, v := range values { if v < min { min = v } if v > max { max = v } } return } // Seq returns a slice of values between min and max func Seq(min int, max int) []int { r := make([]int, 0, max-min+1) for v := min; v <= max; v++ { r = append(r, v) } return r } // Index returns the first index of the target string t, or -1 if no match is found func Index(vs []string, t string) int { for i, v := range vs { if v == t { return i } } return -1 } // Include returns true if the target string t is in the slice func Include(vs []string, t string) bool { return Index(vs, t) >= 0 } // Any returns true if one of the strings in the slice satisfies the predicate f func Any(vs []string, f func(string) bool) bool { for _, v := range vs { if f(v) { return true } } return false } // All returns true if all of the strings in the slice satisfy the predicate f func All(vs []string, f func(string) bool) bool { for _, v := range vs { if !f(v) { return false } } return true } // Filter returns a new slice containing all strings in the slice that satisfy the predicate f func Filter(vs []string, f func(string) bool) []string { vsf := make([]string, 0) for _, v := range vs { if f(v) { vsf = append(vsf, v) } } return vsf } // Map returns a new slice containing the results of applying the function f to each string in the original slice func Map(vs []string, f func(string) string) []string { vsm := make([]string, len(vs)) for i, v := range vs { vsm[i] = f(v) } return vsm }
lib/slice.go
0.805135
0.440048
slice.go
starcoder
package numeric // UniqueInts takes an input slice of ints and // returns a new slice of ints without duplicate values. func UniqueInts(a []int) []int { l := len(a) if l <= 1 { return a } m := make(map[int]struct{}, l) r := make([]int, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r } // UniqueUints takes an input slice of uints and // returns a new slice of uints without duplicate values. func UniqueUints(a []uint) []uint { l := len(a) if l <= 1 { return a } m := make(map[uint]struct{}, l) r := make([]uint, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r } // UniqueInt8s takes an input slice of int8s and // returns a new slice of int8s without duplicate values. func UniqueInt8s(a []int8) []int8 { l := len(a) if l <= 1 { return a } m := make(map[int8]struct{}, l) r := make([]int8, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r } // UniqueUint8s takes an input slice of uint8s and // returns a new slice of uint8s without duplicate values. func UniqueUint8s(a []uint8) []uint8 { l := len(a) if l <= 1 { return a } m := make(map[uint8]struct{}, l) r := make([]uint8, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r } // UniqueInt16s takes an input slice of int16s and // returns a new slice of int16s without duplicate values. func UniqueInt16s(a []int16) []int16 { l := len(a) if l <= 1 { return a } m := make(map[int16]struct{}, l) r := make([]int16, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r } // UniqueUint16s takes an input slice of uint16s and // returns a new slice of uint16s without duplicate values. func UniqueUint16s(a []uint16) []uint16 { l := len(a) if l <= 1 { return a } m := make(map[uint16]struct{}, l) r := make([]uint16, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r } // UniqueInt32s takes an input slice of int32s and // returns a new slice of int32s without duplicate values. func UniqueInt32s(a []int32) []int32 { l := len(a) if l <= 1 { return a } m := make(map[int32]struct{}, l) r := make([]int32, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r } // UniqueUint32s takes an input slice of uint32s and // returns a new slice of uint32s without duplicate values. func UniqueUint32s(a []uint32) []uint32 { l := len(a) if l <= 1 { return a } m := make(map[uint32]struct{}, l) r := make([]uint32, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r } // UniqueInt64s takes an input slice of int64s and // returns a new slice of int64s without duplicate values. func UniqueInt64s(a []int64) []int64 { l := len(a) if l <= 1 { return a } m := make(map[int64]struct{}, l) r := make([]int64, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r } // UniqueUint64s takes an input slice of uint64s and // returns a new slice of uint64s without duplicate values. func UniqueUint64s(a []uint64) []uint64 { l := len(a) if l <= 1 { return a } m := make(map[uint64]struct{}, l) r := make([]uint64, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r } // UniqueFloat64s takes an input slice of float64s and // returns a new slice of float64s without duplicate values. func UniqueFloat64s(a []float64) []float64 { l := len(a) if l <= 1 { return a } m := make(map[float64]struct{}, l) r := make([]float64, 0, l) for _, v := range a { if _, ok := m[v]; !ok { m[v] = struct{}{} r = append(r, v) } } return r }
numeric/unique.go
0.862395
0.487063
unique.go
starcoder
package config import ( "fmt" "time" "github.com/mitchellh/mapstructure" "github.com/ti-mo/conntracct/pkg/bpf" ) // DefaultProbeConfig is the default probe configuration. var DefaultProbeConfig = ProbeConfig{ RateCurve: &Curve{ Zero: &CurvePoint{ Age: durationPtr(0), Rate: durationPtr(20 * time.Second), }, One: &CurvePoint{ Age: durationPtr(1 * time.Minute), Rate: durationPtr(1 * time.Minute), }, Two: &CurvePoint{ Age: durationPtr(5 * time.Minute), Rate: durationPtr(5 * time.Minute), }, }, } // ProbeConfig represents the configuration of an accounting probe. type ProbeConfig struct { // Probe Rate Curve structure. RateCurve *Curve `mapstructure:"rate_curve"` } // Default recursively sets the given default values on the ProbeConfig. // Finds any nil values in the configuration tree and initializes them // to the given default. func (pc *ProbeConfig) Default(def ProbeConfig) { // No ratecurve specified, copy a pointer to the whole default structure. if pc.RateCurve == nil { pc.RateCurve = def.RateCurve } else { pc.RateCurve.Default(*def.RateCurve) } } func (pc *ProbeConfig) String() string { return fmt.Sprintf("ProbeConfig{RateCurve: %s}", pc.RateCurve) } // Curve is the probe's rate curve configuration. type Curve struct { Zero *CurvePoint `mapstructure:"0"` One *CurvePoint `mapstructure:"1"` Two *CurvePoint `mapstructure:"2"` } // Default recursively sets the given default values on the Curve. func (c *Curve) Default(def Curve) { if c.Zero == nil { c.Zero = def.Zero } else { c.Zero.Default(*def.Zero.Age, *def.Zero.Rate) } if c.One == nil { c.One = def.One } else { c.One.Default(*def.One.Age, *def.One.Rate) } if c.Two == nil { c.Two = def.Two } else { c.Two.Default(*def.Two.Age, *def.Two.Rate) } } func (c *Curve) String() string { return fmt.Sprintf("{Zero: %s, One: %s, Two: %s}", c.Zero, c.One, c.Two) } // CurvePoint is an age/rate point in the probe's rate curve. type CurvePoint struct { // The age a flow must have to be affected by this rate. Age *time.Duration `mapstructure:"age"` // The update rate of the flow. Rate *time.Duration `mapstructure:"rate"` } // Default initializes nil age or rate fields on the CurvePoint to the given values. func (cp *CurvePoint) Default(age, rate time.Duration) { if cp.Age == nil { cp.Age = &age } if cp.Rate == nil { cp.Rate = &rate } } func (cp *CurvePoint) String() string { return fmt.Sprintf("[from:%s, every:%s]", cp.Age, cp.Rate) } // DecodeProbeConfigMap extracts a ProbeConfig from a string map of // configuration data as provided by Viper. func DecodeProbeConfigMap(cfg map[string]interface{}) (*ProbeConfig, error) { var out ProbeConfig d, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ DecodeHook: mapstructure.StringToTimeDurationHookFunc(), Result: &out, }) if err != nil { panic(err) } // Decode sink configuration map into SinkConfig. if err := d.Decode(cfg); err != nil { return nil, err } return &out, nil } // BPFConfig extracts a pkg/bpf.Config from a ProbeConfig. func (pc *ProbeConfig) BPFConfig() bpf.Config { return bpf.Config{ Curve0: bpf.CurvePoint{ Age: *pc.RateCurve.Zero.Age, Rate: *pc.RateCurve.Zero.Rate, }, Curve1: bpf.CurvePoint{ Age: *pc.RateCurve.One.Age, Rate: *pc.RateCurve.One.Rate, }, Curve2: bpf.CurvePoint{ Age: *pc.RateCurve.Two.Age, Rate: *pc.RateCurve.Two.Rate, }, } }
internal/config/probe.go
0.710025
0.411702
probe.go
starcoder
package forGraphBLASGo import ( "github.com/intel/forGoParallel/pipeline" ) type matrixAsMask[T Number] struct { v *matrixReference[T] } func newMatrixAsMask[T Number](v *matrixReference[T]) functionalMatrix[bool] { return matrixAsMask[T]{v: v} } func (matrix matrixAsMask[T]) resize(ref *matrixReference[bool], newNRows, newNCols int) *matrixReference[bool] { nrows, ncols := matrix.v.size() if newNRows == nrows && newNCols == ncols { return ref } return newMatrixReference[bool](newMatrixAsMask(matrix.v.resize(newNRows, newNCols)), -1) } func (matrix matrixAsMask[T]) size() (nrows, ncols int) { return matrix.v.size() } func (matrix matrixAsMask[T]) nvals() int { return matrix.v.nvals() } func (matrix matrixAsMask[T]) setElement(ref *matrixReference[bool], value bool, row, col int) *matrixReference[bool] { nrows, ncols := matrix.v.size() return newMatrixReference[bool](newListMatrix[bool](nrows, ncols, ref, &matrixValueList[bool]{ row: row, col: col, value: value, }, ), -1) } func (matrix matrixAsMask[T]) removeElement(ref *matrixReference[bool], row, col int) *matrixReference[bool] { nrows, ncols := matrix.v.size() return newMatrixReference[bool](newListMatrix[bool](nrows, ncols, ref, &matrixValueList[bool]{ row: -row, col: -col, }, ), -1) } func (matrix matrixAsMask[T]) extractElement(row, col int) (bool, bool) { if value, ok := matrix.v.extractElement(row, col); ok { return value != 0, true } return false, false } func (matrix matrixAsMask[T]) getPipeline() *pipeline.Pipeline[any] { p := matrix.v.getPipeline() if p == nil { return nil } p.Add( pipeline.Par(pipeline.Receive(func(_ int, data any) any { slice := data.(matrixSlice[T]) result := matrixSlice[bool]{ cow: slice.cow &^ cowv, rows: slice.rows, cols: slice.cols, values: make([]bool, len(slice.values)), } for i, value := range slice.values { result.values[i] = value != 0 } return result })), ) return p } func adaptAsMaskPipeline[T Number](p *pipeline.Pipeline[any]) { if p == nil { return } p.Add( pipeline.Par(pipeline.Receive(func(_ int, data any) any { slice := data.(vectorSlice[T]) result := vectorSlice[bool]{ cow: slice.cow &^ cowv, indices: slice.indices, values: make([]bool, len(slice.values)), } for i, value := range slice.values { result.values[i] = value != 0 } return result })), ) } func (matrix matrixAsMask[T]) getRowPipeline(row int) *pipeline.Pipeline[any] { p := matrix.v.getRowPipeline(row) adaptAsMaskPipeline[T](p) return p } func (matrix matrixAsMask[T]) getColPipeline(col int) *pipeline.Pipeline[any] { p := matrix.v.getColPipeline(col) adaptAsMaskPipeline[T](p) return p } func (matrix matrixAsMask[T]) getRowPipelines() []matrix1Pipeline { ps := matrix.v.getRowPipelines() for _, p := range ps { adaptAsMaskPipeline[T](p.p) } return ps } func (matrix matrixAsMask[T]) getColPipelines() []matrix1Pipeline { ps := matrix.v.getColPipelines() for _, p := range ps { adaptAsMaskPipeline[T](p.p) } return ps } func (matrix matrixAsMask[T]) optimized() bool { return matrix.v.optimized() } func (matrix matrixAsMask[T]) optimize() functionalMatrix[bool] { matrix.v.optimize() return matrix } type matrixAsStructuralMask[T any] struct { v *matrixReference[T] } func newMatrixAsStructuralMask[T any](v *matrixReference[T]) functionalMatrix[bool] { return matrixAsStructuralMask[T]{v: v} } func (v matrixAsStructuralMask[T]) resize(ref *matrixReference[bool], newNRows, newNCols int) *matrixReference[bool] { nrows, ncols := v.v.size() if newNRows == nrows && newNCols == ncols { return ref } return newMatrixReference[bool](newMatrixAsStructuralMask(v.v.resize(newNRows, newNCols)), -1) } func (v matrixAsStructuralMask[T]) size() (nrows, ncols int) { return v.v.size() } func (v matrixAsStructuralMask[T]) nvals() int { return v.v.nvals() } func (v matrixAsStructuralMask[T]) setElement(ref *matrixReference[bool], value bool, row, col int) *matrixReference[bool] { nrows, ncols := v.v.size() return newMatrixReference[bool](newListMatrix[bool](nrows, ncols, ref, &matrixValueList[bool]{ row: row, col: col, value: value, }, ), -1) } func (v matrixAsStructuralMask[T]) removeElement(ref *matrixReference[bool], row, col int) *matrixReference[bool] { nrows, ncols := v.v.size() return newMatrixReference[bool](newListMatrix[bool](nrows, ncols, ref, &matrixValueList[bool]{ row: -row, col: -col, }, ), -1) } func (v matrixAsStructuralMask[T]) extractElement(row, col int) (bool, bool) { // todo: when accessing the first return value, this should normally // result in a DomainMismatch, so check the program flow for this _, ok := v.v.extractElement(row, col) return ok, ok } func (matrix matrixAsStructuralMask[T]) getPipeline() *pipeline.Pipeline[any] { p := matrix.v.getPipeline() if p == nil { return nil } p.Add( pipeline.Par(pipeline.Receive(func(_ int, data any) any { slice := data.(matrixSlice[T]) result := matrixSlice[bool]{ cow: slice.cow &^ cowv, rows: slice.rows, cols: slice.cols, values: make([]bool, len(slice.values)), } for i := range result.values { result.values[i] = true } return result })), ) return p } func adaptAsStructuralMaskPipeline[T any](p *pipeline.Pipeline[any]) { if p == nil { return } p.Add( pipeline.Par(pipeline.Receive(func(_ int, data any) any { slice := data.(vectorSlice[T]) result := vectorSlice[bool]{ cow: slice.cow &^ cowv, indices: slice.indices, values: make([]bool, len(slice.values)), } for i := range result.values { result.values[i] = true } return result })), ) } func (matrix matrixAsStructuralMask[T]) getRowPipeline(row int) *pipeline.Pipeline[any] { p := matrix.v.getRowPipeline(row) adaptAsStructuralMaskPipeline[T](p) return p } func (matrix matrixAsStructuralMask[T]) getColPipeline(col int) *pipeline.Pipeline[any] { p := matrix.v.getRowPipeline(col) adaptAsStructuralMaskPipeline[T](p) return p } func (matrix matrixAsStructuralMask[T]) getRowPipelines() []matrix1Pipeline { ps := matrix.v.getRowPipelines() for _, p := range ps { adaptAsStructuralMaskPipeline[T](p.p) } return ps } func (matrix matrixAsStructuralMask[T]) getColPipelines() []matrix1Pipeline { ps := matrix.v.getColPipelines() for _, p := range ps { adaptAsStructuralMaskPipeline[T](p.p) } return ps } func (v matrixAsStructuralMask[T]) optimized() bool { return v.v.optimized() } func (v matrixAsStructuralMask[T]) optimize() functionalMatrix[bool] { v.v.optimize() return v }
functional_MatrixAsMask.go
0.569733
0.55435
functional_MatrixAsMask.go
starcoder
package velocypack // builderBuffer is a byte slice used for building slices. type builderBuffer []byte const ( minGrowDelta = 128 // Minimum amount of extra bytes to add to a buffer when growing maxGrowDelta = 1024 * 1024 // Maximum amount of extra bytes to add to a buffer when growing ) // IsEmpty returns 0 if there are no values in the buffer. func (b builderBuffer) IsEmpty() bool { l := len(b) return l == 0 } // Len returns the length of the buffer. func (b builderBuffer) Len() ValueLength { l := len(b) return ValueLength(l) } // Bytes returns the bytes written to the buffer. // The returned slice is only valid until the next modification. func (b *builderBuffer) Bytes() []byte { return *b } // WriteByte appends a single byte to the buffer. func (b *builderBuffer) WriteByte(v byte) { off := len(*b) b.growCapacity(1) *b = (*b)[:off+1] (*b)[off] = v } // WriteBytes appends a series of identical bytes to the buffer. func (b *builderBuffer) WriteBytes(v byte, count uint) { if count == 0 { return } off := uint(len(*b)) b.growCapacity(count) *b = (*b)[:off+count] for i := uint(0); i < count; i++ { (*b)[off+i] = v } } // Write appends a series of bytes to the buffer. func (b *builderBuffer) Write(v []byte) { l := uint(len(v)) if l > 0 { off := uint(len(*b)) b.growCapacity(l) *b = (*b)[:off+l] copy((*b)[off:], v) } } // ReserveSpace ensures that at least n bytes can be added to the buffer without allocating new memory. func (b *builderBuffer) ReserveSpace(n uint) { if n > 0 { b.growCapacity(n) } } // Shrink reduces the length of the buffer by n elements (removing the last elements). func (b *builderBuffer) Shrink(n uint) { if n > 0 { newLen := uint(len(*b)) - n if newLen < 0 { newLen = 0 } *b = (*b)[:newLen] } } // Grow adds n elements to the buffer, returning a slice where the added elements start. func (b *builderBuffer) Grow(n uint) []byte { l := uint(len(*b)) if n > 0 { b.growCapacity(n) *b = (*b)[:l+n] } return (*b)[l:] } // growCapacity ensures that there is enough capacity in the buffer to add n elements. func (b *builderBuffer) growCapacity(n uint) { _b := *b curLen := uint(len(_b)) curCap := uint(cap(_b)) newCap := curLen + n if newCap <= curCap { // No need to do anything return } // Increase the capacity extra := newCap // Grow a bit more to avoid copying all the time if extra < minGrowDelta { extra = minGrowDelta } else if extra > maxGrowDelta { extra = maxGrowDelta } newBuffer := make(builderBuffer, curLen, newCap+extra) copy(newBuffer, _b) *b = newBuffer }
deps/github.com/arangodb/go-velocypack/builder_buffer.go
0.802246
0.46557
builder_buffer.go
starcoder
package advent import ( "fmt" "log" "sort" ) func oneAndThreeGaps(filename string) (ones int, threes int) { values, err := readIntFile(filename, "\n") if err != nil { log.Fatal(err) } sort.Ints(values) values = append(values, values[len(values)-1]+3) old := 0 for _, value := range values { switch value - old { case 1: ones++ case 3: threes++ } old = value } return } func nConsecutive(values []int, start int) (consecutive int) { consecutive = 1 for jj, newValue := range values { if newValue == start+jj+1 { consecutive++ } } return } // count multiplicity for a given length of consecutive numbers // the first and last elements must be maintained // the maximum difference between two numbers is three func multiplicity(consecutive int) (total int) { if consecutive < 3 { total = 1 } else if consecutive == 3 { total = 2 } else { total = 1 + 3<<(consecutive-4) } return } func countPossibilities(filename string) (start int) { values, err := readIntFile(filename, "\n") if err != nil { log.Fatal(err) } sort.Ints(values) nPossibilities := 1 for ii, value := range values { if ii == 0 { if value != 1 { continue } consecutive := nConsecutive(values[ii+1:], value) + 1 nPossibilities *= multiplicity(consecutive) } else if value == values[ii-1]+1 { continue } else { consecutive := nConsecutive(values[ii+1:], value) nPossibilities *= multiplicity(consecutive) } } return nPossibilities } /* --- Day 10: Adapter Array --- Patched into the aircraft's data port, you discover weather forecasts of a massive tropical storm. Before you can figure out whether it will impact your vacation plans, however, your device suddenly turns off! Its battery is dead. You'll need to plug it in. There's only one problem: the charging outlet near your seat produces the wrong number of jolts. Always prepared, you make a list of all of the joltage adapters in your bag. Each of your joltage adapters is rated for a specific output joltage (your puzzle input). Any given adapter can take an input 1, 2, or 3 jolts lower than its rating and still produce its rated output joltage. In addition, your device has a built-in joltage adapter rated for 3 jolts higher than the highest-rated adapter in your bag. (If your adapter list were 3, 9, and 6, your device's built-in adapter would be rated for 12 jolts.) Treat the charging outlet near your seat as having an effective joltage rating of 0. Since you have some time to kill, you might as well test all of your adapters. Wouldn't want to get to your resort and realize you can't even charge your device! If you use every adapter in your bag at once, what is the distribution of joltage differences between the charging outlet, the adapters, and your device? For example, suppose that in your bag, you have adapters with the following joltage ratings: 16 10 15 5 1 11 7 19 6 12 4 With these adapters, your device's built-in joltage adapter would be rated for 19 + 3 = 22 jolts, 3 higher than the highest-rated adapter. Because adapters can only connect to a source 1-3 jolts lower than its rating, in order to use every adapter, you'd need to choose them like this: The charging outlet has an effective rating of 0 jolts, so the only adapters that could connect to it directly would need to have a joltage rating of 1, 2, or 3 jolts. Of these, only one you have is an adapter rated 1 jolt (difference of 1). From your 1-jolt rated adapter, the only choice is your 4-jolt rated adapter (difference of 3). From the 4-jolt rated adapter, the adapters rated 5, 6, or 7 are valid choices. However, in order to not skip any adapters, you have to pick the adapter rated 5 jolts (difference of 1). Similarly, the next choices would need to be the adapter rated 6 and then the adapter rated 7 (with difference of 1 and 1). The only adapter that works with the 7-jolt rated adapter is the one rated 10 jolts (difference of 3). From 10, the choices are 11 or 12; choose 11 (difference of 1) and then 12 (difference of 1). After 12, only valid adapter has a rating of 15 (difference of 3), then 16 (difference of 1), then 19 (difference of 3). Finally, your device's built-in adapter is always 3 higher than the highest adapter, so its rating is 22 jolts (always a difference of 3). In this example, when using every adapter, there are 7 differences of 1 jolt and 5 differences of 3 jolts. Here is a larger example: 28 33 18 42 31 14 46 20 48 47 24 23 49 45 19 38 39 11 1 32 25 35 8 17 7 9 4 2 34 10 3 In this larger example, in a chain that uses all of the adapters, there are 22 differences of 1 jolt and 10 differences of 3 jolts. Find a chain that uses all of your adapters to connect the charging outlet to your device's built-in adapter and count the joltage differences between the charging outlet, the adapters, and your device. What is the number of 1-jolt differences multiplied by the number of 3-jolt differences? --- Part Two --- To completely determine whether you have enough adapters, you'll need to figure out how many different ways they can be arranged. Every arrangement needs to connect the charging outlet to your device. The previous rules about when adapters can successfully connect still apply. The first example above (the one that starts with 16, 10, 15) supports the following arrangements: (0), 1, 4, 5, 6, 7, 10, 11, 12, 15, 16, 19, (22) (0), 1, 4, 5, 6, 7, 10, 12, 15, 16, 19, (22) (0), 1, 4, 5, 7, 10, 11, 12, 15, 16, 19, (22) (0), 1, 4, 5, 7, 10, 12, 15, 16, 19, (22) (0), 1, 4, 6, 7, 10, 11, 12, 15, 16, 19, (22) (0), 1, 4, 6, 7, 10, 12, 15, 16, 19, (22) (0), 1, 4, 7, 10, 11, 12, 15, 16, 19, (22) (0), 1, 4, 7, 10, 12, 15, 16, 19, (22) (The charging outlet and your device's built-in adapter are shown in parentheses.) Given the adapters from the first example, the total number of arrangements that connect the charging outlet to your device is 8. The second example above (the one that starts with 28, 33, 18) has many arrangements. Here are a few: (0), 1, 2, 3, 4, 7, 8, 9, 10, 11, 14, 17, 18, 19, 20, 23, 24, 25, 28, 31, 32, 33, 34, 35, 38, 39, 42, 45, 46, 47, 48, 49, (52) (0), 1, 2, 3, 4, 7, 8, 9, 10, 11, 14, 17, 18, 19, 20, 23, 24, 25, 28, 31, 32, 33, 34, 35, 38, 39, 42, 45, 46, 47, 49, (52) (0), 1, 2, 3, 4, 7, 8, 9, 10, 11, 14, 17, 18, 19, 20, 23, 24, 25, 28, 31, 32, 33, 34, 35, 38, 39, 42, 45, 46, 48, 49, (52) (0), 1, 2, 3, 4, 7, 8, 9, 10, 11, 14, 17, 18, 19, 20, 23, 24, 25, 28, 31, 32, 33, 34, 35, 38, 39, 42, 45, 46, 49, (52) (0), 1, 2, 3, 4, 7, 8, 9, 10, 11, 14, 17, 18, 19, 20, 23, 24, 25, 28, 31, 32, 33, 34, 35, 38, 39, 42, 45, 47, 48, 49, (52) (0), 3, 4, 7, 10, 11, 14, 17, 20, 23, 25, 28, 31, 34, 35, 38, 39, 42, 45, 46, 48, 49, (52) (0), 3, 4, 7, 10, 11, 14, 17, 20, 23, 25, 28, 31, 34, 35, 38, 39, 42, 45, 46, 49, (52) (0), 3, 4, 7, 10, 11, 14, 17, 20, 23, 25, 28, 31, 34, 35, 38, 39, 42, 45, 47, 48, 49, (52) (0), 3, 4, 7, 10, 11, 14, 17, 20, 23, 25, 28, 31, 34, 35, 38, 39, 42, 45, 47, 49, (52) (0), 3, 4, 7, 10, 11, 14, 17, 20, 23, 25, 28, 31, 34, 35, 38, 39, 42, 45, 48, 49, (52) In total, this set of adapters can connect the charging outlet to your device in 19208 distinct arrangements. You glance back down at your bag and try to remember why you brought so many adapters; there must be more than a trillion valid ways to arrange them! Surely, there must be an efficient way to count the arrangements. What is the total number of distinct ways you can arrange the adapters to connect the charging outlet to your device? */ func Day10() { fmt.Println("Test") ones, threes := oneAndThreeGaps("inputs/day10_test.txt") fmt.Println("Part 1: ", ones*threes) fmt.Println("Part 2: ", countPossibilities("inputs/day10_test.txt")) fmt.Println("Main") ones, threes = oneAndThreeGaps("inputs/day10.txt") fmt.Println("Part 1: ", ones*threes) fmt.Println("Part 2: ", countPossibilities("inputs/day10.txt")) }
cmd/day10.go
0.624179
0.51068
day10.go
starcoder
package satellite import ( "fmt" "math" "strconv" "strings" ) // Constants const TWOPI float64 = math.Pi * 2.0 const DEG2RAD float64 = math.Pi / 180.0 const RAD2DEG float64 = 180.0 / math.Pi const XPDOTP float64 = 1440.0 / (2.0 * math.Pi) // Holds latitude and Longitude in either degrees or radians type LatLong struct { Latitude, Longitude float64 } // Holds latitude and Longitude in either degrees or radians type LatLongAlt struct { LatLong LatLong AltitudeKm float64 } // Holds X, Y, Z position type Vector3 struct { X, Y, Z float64 } // Holds an azimuth, elevation and range type LookAngles struct { Az, El, Rg float64 } type JDay struct { Day, Fraction float64 } // Parses a two line element dataset into a Satellite struct func ParseTLE(line1, line2 string) (sat Satellite, err error) { if len(line1) != 69 { return sat, fmt.Errorf("Line1 length should be 69 but was %d", len(line1)) } if len(line2) != 69 { return sat, fmt.Errorf("Line2 length should be 69 but was %d", len(line2)) } sat.Line1 = line1 sat.Line2 = line2 // LINE 1 BEGIN sat.Satnum, err = parseInt(strings.TrimSpace(line1[2:7])) if err != nil { err = fmt.Errorf("Error on parsing line1[2:7]: %v", err) return } sat.epochyr, err = parseInt(line1[18:20]) if err != nil { err = fmt.Errorf("Error on parsing line1[18:20]: %v", err) return } sat.epochdays, err = parseFloat(line1[20:32]) if err != nil { err = fmt.Errorf("Error on parsing line1[20:32]: %v", err) return } // These three can be negative / positive sat.ndot, err = parseFloat(strings.Replace(line1[33:43], " ", "", 2)) if err != nil { err = fmt.Errorf("Error on parsing line1[33:43]: %v", err) return } sat.nddot, err = parseFloat(strings.Replace(line1[44:45]+"."+line1[45:50]+"e"+line1[50:52], " ", "", 2)) if err != nil { err = fmt.Errorf("Error on parsing line1[44:52]: %v", err) return } sat.bstar, err = parseFloat(strings.Replace(line1[53:54]+"."+line1[54:59]+"e"+line1[59:61], " ", "", 2)) if err != nil { err = fmt.Errorf("Error on parsing line1[53:61]: %v", err) return } // LINE 1 END // LINE 2 BEGIN sat.inclo, err = parseFloat(strings.Replace(line2[8:16], " ", "", 2)) if err != nil { err = fmt.Errorf("Error on parsing line2[8:16]: %v", err) return } sat.nodeo, err = parseFloat(strings.Replace(line2[17:25], " ", "", 2)) if err != nil { err = fmt.Errorf("Error on parsing line2[17:25]: %v", err) return } sat.ecco, err = parseFloat("." + line2[26:33]) if err != nil { err = fmt.Errorf("Error on parsing line2[26:33]: %v", err) return } sat.argpo, err = parseFloat(strings.Replace(line2[34:42], " ", "", 2)) if err != nil { err = fmt.Errorf("Error on parsing line2[34:42]: %v", err) return } sat.mo, err = parseFloat(strings.Replace(line2[43:51], " ", "", 2)) if err != nil { err = fmt.Errorf("Error on parsing line2[43:51]: %v", err) return } sat.no, err = parseFloat(strings.Replace(line2[52:63], " ", "", 2)) if err != nil { err = fmt.Errorf("Error on parsing line2[52:63]: %v", err) return } // LINE 2 END return } // Converts a two line element data set into a Satellite struct and runs sgp4init func NewSatFromTLE(line1, line2 string, gravconst string) (Satellite, error) { sat, err := ParseTLE(line1, line2) if err != nil { return sat, err } sat.Gravity, err = GetGravConst(gravconst) if err != nil { return sat, fmt.Errorf("Error on getting gravconst: %v", err) } sat.no = sat.no / XPDOTP sat.ndot = sat.ndot / (XPDOTP * 1440.0) sat.nddot = sat.nddot / (XPDOTP * 1440.0 * 1440) sat.inclo = sat.inclo * DEG2RAD sat.nodeo = sat.nodeo * DEG2RAD sat.argpo = sat.argpo * DEG2RAD sat.mo = sat.mo * DEG2RAD var year int64 = 0 if sat.epochyr < 57 { year = sat.epochyr + 2000 } else { year = sat.epochyr + 1900 } mon, day, hr, min, sec := days2mdhms(year, sat.epochdays) sat.jdsatepoch = NewJDay(int(year), int(mon), int(day), int(hr), int(min), sec) _, _, err = sat.sgp4init(sat.jdsatepoch.Subtract(2433281.5)) return sat, err } func NewLatLongAlt(latitudeDeg, longitudeDeg, altitudeKm float64) LatLongAlt { return LatLongAlt{ LatLong: LatLong{ Latitude: DEG2RAD * latitudeDeg, Longitude: DEG2RAD * longitudeDeg}, AltitudeKm: altitudeKm, } } func (jd JDay) Subtract(time float64) float64 { return jd.Day + jd.Fraction - time } func (jd JDay) SubtractDay(j JDay) float64 { return (jd.Day-j.Day)*1440 + (jd.Fraction-j.Fraction)*1440 } func (jd JDay) Single() float64 { return jd.Day + jd.Fraction } // Parses a string into a float64 value. func parseFloat(strIn string) (ret float64, err error) { strIn = strings.Replace(strIn, " ", "0", -1) return strconv.ParseFloat(strIn, 64) } // Parses a string into a int64 value. func parseInt(strIn string) (int64, error) { return strconv.ParseInt(strIn, 10, 0) }
helpers.go
0.728265
0.509642
helpers.go
starcoder
package fun import "math" // ModBesselI0 returns the modified Bessel function I0(x) for any real x. func ModBesselI0(x float64) (ans float64) { ax := math.Abs(x) if ax < 15.0 { // Rational approximation. y := x * x return mbpoly(i0p, 13, y) / mbpoly(i0q, 4, 225.0-y) } // rational approximation with exp(x)/sqrt(x) factored out. z := 1.0 - 15.0/ax return math.Exp(ax) * mbpoly(i0pp, 4, z) / (mbpoly(i0qq, 5, z) * math.Sqrt(ax)) } // ModBesselI1 returns the modified Bessel function I1(x) for any real x. func ModBesselI1(x float64) (ans float64) { ax := math.Abs(x) if ax < 15.0 { // Rational approximation. y := x * x return x * mbpoly(i1p, 13, y) / mbpoly(i1q, 4, 225.0-y) } // rational approximation with exp(x)/sqrt(x) factored out. z := 1.0 - 15.0/ax ans = math.Exp(ax) * mbpoly(i1pp, 4, z) / (mbpoly(i1qq, 5, z) * math.Sqrt(ax)) if x > 0.0 { return ans } return -ans } // ModBesselIn returns the modified Bessel function In(x) for any real x and n ≥ 0 func ModBesselIn(n int, x float64) (ans float64) { if n == 0 { return ModBesselI0(x) } if n == 1 { return ModBesselI1(x) } if x*x <= 8.0*math.SmallestNonzeroFloat64 { return 0.0 } ACC := 200.0 // ACC determines accuracy. IEXP := 1024 / 2 // numeric_limits<double>::max_exponent/2; tox := 2.0 / math.Abs(x) bip := 0.0 bi := 1.0 var k int var bim float64 for j := 2 * (n + int(math.Sqrt(ACC*float64(n)))); j > 0; j-- { // Downward recurrence. bim = bip + float64(j)*tox*bi bip = bi bi = bim _, k = math.Frexp(bi) if k > IEXP { // Renormalize to prevent overflows. ans = math.Ldexp(ans, -IEXP) bi = math.Ldexp(bi, -IEXP) bip = math.Ldexp(bip, -IEXP) } if j == n { ans = bip } } ans *= ModBesselI0(x) / bi // Normalize with I0. if x < 0.0 && (n&1) != 0 { // n&1 != 0 ⇒ is odd return -ans } return } // ModBesselK0 returns the modified Bessel function K0(x) for positive real x. // Special cases: // K0(x=0) = +Inf // K0(x<0) = NaN func ModBesselK0(x float64) float64 { if x < 0 { return math.NaN() } if x == 0 { return math.Inf(+1) } if x <= 1.0 { // Use two rational approximations. z := x * x term := mbpoly(k0pi, 4, z) * math.Log(x) / mbpoly(k0qi, 2, 1.-z) return mbpoly(k0p, 4, z)/mbpoly(k0q, 2, 1.-z) - term } // rational approximation with exp(-x) / sqrt(x) factored out. z := 1.0 / x return math.Exp(-x) * mbpoly(k0pp, 7, z) / (mbpoly(k0qq, 7, z) * math.Sqrt(x)) } // ModBesselK1 returns the modified Bessel function K1(x) for positive real x. // Special cases: // K0(x=0) = +Inf // K0(x<0) = NaN func ModBesselK1(x float64) float64 { if x < 0 { return math.NaN() } if x == 0 { return math.Inf(+1) } if x <= 1.0 { // Use two rational approximations. z := x * x term := mbpoly(k1pi, 4, z) * math.Log(x) / mbpoly(k1qi, 2, 1.-z) return x*(mbpoly(k1p, 4, z)/mbpoly(k1q, 2, 1.-z)+term) + 1./x } // rational approximation with exp(-x)/sqrt(x) factored out. z := 1.0 / x return math.Exp(-x) * mbpoly(k1pp, 7, z) / (mbpoly(k1qq, 7, z) * math.Sqrt(x)) } // ModBesselKn returns the modified Bessel function Kn(x) for positive x and n ≥ 0 func ModBesselKn(n int, x float64) float64 { if n == 0 { return ModBesselK0(x) } if n == 1 { return ModBesselK1(x) } if x < 0 { return math.NaN() } if x == 0 { return math.Inf(+1) } tox := 2.0 / x bkm := ModBesselK0(x) // Upward recurrence for all x... bk := ModBesselK1(x) var bkp float64 for j := 1; j < n; j++ { bkp = bkm + float64(j)*tox*bk bkm = bk bk = bkp } return bk } // mbpoly evaluate a polynomial for the modified Bessel functions func mbpoly(cof []float64, n int, x float64) (ans float64) { ans = cof[n] for i := n - 1; i >= 0; i-- { ans = ans*x + cof[i] } return } // constants var ( i0p = []float64{9.999999999999997e-1, 2.466405579426905e-1, 1.478980363444585e-2, 3.826993559940360e-4, 5.395676869878828e-6, 4.700912200921704e-8, 2.733894920915608e-10, 1.115830108455192e-12, 3.301093025084127e-15, 7.209167098020555e-18, 1.166898488777214e-20, 1.378948246502109e-23, 1.124884061857506e-26, 5.498556929587117e-30} i0q = []float64{4.463598170691436e-1, 1.702205745042606e-3, 2.792125684538934e-6, 2.369902034785866e-9, 8.965900179621208e-13} i0pp = []float64{1.192273748120670e-1, 1.947452015979746e-1, 7.629241821600588e-2, 8.474903580801549e-3, 2.023821945835647e-4} i0qq = []float64{2.962898424533095e-1, 4.866115913196384e-1, 1.938352806477617e-1, 2.261671093400046e-2, 6.450448095075585e-4, 1.529835782400450e-6} i1p = []float64{5.000000000000000e-1, 6.090824836578078e-2, 2.407288574545340e-3, 4.622311145544158e-5, 5.161743818147913e-7, 3.712362374847555e-9, 1.833983433811517e-11, 6.493125133990706e-14, 1.693074927497696e-16, 3.299609473102338e-19, 4.813071975603122e-22, 5.164275442089090e-25, 3.846870021788629e-28, 1.712948291408736e-31} i1q = []float64{4.665973211630446e-1, 1.677754477613006e-3, 2.583049634689725e-6, 2.045930934253556e-9, 7.166133240195285e-13} i1pp = []float64{1.286515211317124e-1, 1.930915272916783e-1, 6.965689298161343e-2, 7.345978783504595e-3, 1.963602129240502e-4} i1qq = []float64{3.309385098860755e-1, 4.878218424097628e-1, 1.663088501568696e-1, 1.473541892809522e-2, 1.964131438571051e-4, -1.034524660214173e-6} k0pi = []float64{1.0, 2.346487949187396e-1, 1.187082088663404e-2, 2.150707366040937e-4, 1.425433617130587e-6} k0qi = []float64{9.847324170755358e-1, 1.518396076767770e-2, 8.362215678646257e-5} k0p = []float64{1.159315156584126e-1, 2.770731240515333e-1, 2.066458134619875e-2, 4.574734709978264e-4, 3.454715527986737e-6} k0q = []float64{9.836249671709183e-1, 1.627693622304549e-2, 9.809660603621949e-5} k0pp = []float64{1.253314137315499, 1.475731032429900e1, 6.123767403223466e1, 1.121012633939949e2, 9.285288485892228e1, 3.198289277679660e1, 3.595376024148513, 6.160228690102976e-2} k0qq = []float64{1.0, 1.189963006673403e1, 5.027773590829784e1, 9.496513373427093e1, 8.318077493230258e1, 3.181399777449301e1, 4.443672926432041, 1.408295601966600e-1} k1pi = []float64{0.5, 5.598072040178741e-2, 1.818666382168295e-3, 2.397509908859959e-5, 1.239567816344855e-7} k1qi = []float64{9.870202601341150e-1, 1.292092053534579e-2, 5.881933053917096e-5} k1p = []float64{-3.079657578292062e-1, -8.109417631822442e-2, -3.477550948593604e-3, -5.385594871975406e-5, -3.110372465429008e-7} k1q = []float64{9.861813171751389e-1, 1.375094061153160e-2, 6.774221332947002e-5} k1pp = []float64{1.253314137315502, 1.457171340220454e1, 6.063161173098803e1, 1.147386690867892e2, 1.040442011439181e2, 4.356596656837691e1, 7.265230396353690, 3.144418558991021e-1} k1qq = []float64{1.0, 1.125154514806458e1, 4.427488496597630e1, 7.616113213117645e1, 5.863377227890893e1, 1.850303673841586e1, 1.857244676566022, 2.538540887654872e-2} )
fun/modbessel.go
0.827759
0.495972
modbessel.go
starcoder
package bst // Item - the type to be sorted type Item interface{} // Node of a binary tree type Node struct { value Item left *Node right *Node parent *Node // doubly linked } // PrioritizeTreeItem - custom comparison for prioritizing tree items // basic sort would need "a < b" ("a > b" for hight to low) type PrioritizeTreeItem func(a, b Item) bool // EquivalenceTreeItem - custom comparison for equality of tree items, "a == b" // needed for search type EquivalenceTreeItem func(a, b Item) bool // BinaryTree holds the root of the tree and its comparison function type BinaryTree struct { root *Node lesser PrioritizeTreeItem equals EquivalenceTreeItem } // MakeNode puts Item into a Node, sets parent, returns pointer func MakeNode(val Item, p *Node) *Node { return &Node{ value: val, left: nil, right: nil, parent: p, } } // Init sets both root node and comparison func func (t *BinaryTree) Init(root Item, a PrioritizeTreeItem, b EquivalenceTreeItem) { if a == nil { t.SetLTIntPrioritizeTreeItem() } else { t.SetPrioritizeTreeItem(a) } if b == nil { t.SetEqIntEquivalenceTreeItem() } else { t.SetEquivalenceTreeItem(b) } // Insert() uses lesser() methods, so SetPrioritizeTreeItem() must run first t.Insert(root) } // SetPrioritizeTreeItem - "a < b" or whatever comparison is needed func (t *BinaryTree) SetPrioritizeTreeItem(a PrioritizeTreeItem) { t.lesser = a } // SetLTIntPrioritizeTreeItem - default "a < b" as ints func (t *BinaryTree) SetLTIntPrioritizeTreeItem() { t.lesser = func(a, b Item) bool { return a.(int) < b.(int) } } // SetEquivalenceTreeItem - "a == b" or whatever comparison is needed func (t *BinaryTree) SetEquivalenceTreeItem(b EquivalenceTreeItem) { t.equals = b } // SetEqIntEquivalenceTreeItem - default "a == b" as ints func (t *BinaryTree) SetEqIntEquivalenceTreeItem() { t.equals = func(a, b Item) bool { return a.(int) == b.(int) } } // Insert a new Item to a tree func (t *BinaryTree) Insert(newValue Item) { var y *Node x := t.root z := MakeNode(newValue, nil) for x != nil { y = x if t.lesser(z.value, x.value) { x = x.left } else { x = x.right } } z.parent = y if y == nil { t.root = z // tree was empty } else if t.lesser(z.value, y.value) { y.left = z } else { y.right = z } } // InsertRecursive a new Item to a tree func (t *BinaryTree) InsertRecursive(branchRoot, newValue *Node) *Node { if branchRoot == nil { return newValue } else if t.lesser(newValue.value, branchRoot.value) { if branchRoot.left == nil { newValue.parent = branchRoot branchRoot.left = t.InsertRecursive(branchRoot.left, newValue) } else { t.InsertRecursive(branchRoot.left, newValue) } return branchRoot.left.parent } else { if branchRoot.right == nil { newValue.parent = branchRoot branchRoot.right = t.InsertRecursive(branchRoot.right, newValue) } else { t.InsertRecursive(branchRoot.right, newValue) } return branchRoot.right.parent } } // GetRoot node helper func (t BinaryTree) GetRoot() *Node { return t.root } // InOrderTreeWalk does left, current, right // closes channel when done func (t BinaryTree) InOrderTreeWalk(n *Node, c chan Item) { x := n var last *Node for x != nil { if x.left != nil && (last == nil || t.lesser(last.value, x.left.value)) { x = x.left } else { if last != x && (last == nil || t.lesser(last.value, x.value)) { c <- x.value last = x } if x.right != nil && (last == nil || t.lesser(last.value, x.right.value)) { x = x.right } else { x = x.parent } } } close(c) } // InOrderTreeWalkRecursive does left, current, right // closes channel when done // doesn't close channel if called on nil branch func (t BinaryTree) InOrderTreeWalkRecursive(n *Node, c chan Item) { if n != nil { t.InOrderTreeWalkRecursive(n.left, c) c <- n.value t.InOrderTreeWalkRecursive(n.right, c) if t.equals(n.value, t.root.value) { close(c) } } } // SearchRecursive to find node with Item in current branch or nil if none func (t BinaryTree) SearchRecursive(k Item, current *Node) *Node { if current == nil || t.equals(current.value, k) { return current } else if t.lesser(k, current.value) { return t.Search(k, current.left) } else { return t.Search(k, current.right) } } // Search to find node with Item in current branch or nil if none func (t BinaryTree) Search(k Item, current *Node) *Node { x := current if x == nil { x = t.root } kval := k for x != nil && !t.equals(x.value, kval) { if t.lesser(kval, x.value) { x = x.left } else { x = x.right } } return x } // GetMinimum finds lowest value func (t BinaryTree) GetMinimum(current *Node) *Node { x := current for x != nil && x.left != nil { x = x.left } return x } // GetMaximum finds highest value func (t BinaryTree) GetMaximum(current *Node) *Node { x := current for x != nil && x.right != nil { x = x.right } return x } // GetNext finds successor in order func (t BinaryTree) GetNext(current *Node) *Node { x := current if x == nil { return nil } if x.right != nil { return t.GetMinimum(x.right) } y := x.parent for y != nil && x == y.right { x = y y = y.parent } return y } // GetPrevious finds predecessor in order func (t BinaryTree) GetPrevious(current *Node) *Node { x := current if x == nil { return nil } if x.left != nil { return t.GetMaximum(x.left) } y := x.parent for y != nil && x == y.left { x = y y = y.parent } return y } // Transplant switches branch u with v // Does _NOT_ update sub branches func (t *BinaryTree) Transplant(u, v *Node) { if u.parent == nil { t.root = v } else if u == u.parent.left { u.parent.left = v } else { u.parent.right = v } if v != nil { v.parent = u.parent } } // Delete removes a node and adjusts tree accordingly func (t *BinaryTree) Delete(z *Node) { if z == nil { return } if z.left == nil { t.Transplant(z, z.right) } else if z.right == nil { t.Transplant(z, z.left) } else { y := t.GetMinimum(z.right) if y.parent != z { t.Transplant(y, y.right) y.right = z.right y.right.parent = y } t.Transplant(z, y) y.left = z.left y.left.parent = y } }
bst/bst.go
0.829665
0.454835
bst.go
starcoder
package easybind import ( "reflect" "strconv" "strings" "time" ) func stringBinder(val string, typ reflect.Type) reflect.Value { return reflect.ValueOf(val) } func uintBinder(val string, typ reflect.Type) reflect.Value { if len(val) == 0 { return reflect.Zero(typ) } uintValue, err := strconv.ParseUint(val, 10, 64) if err != nil { return reflect.Zero(typ) } pValue := reflect.New(typ) pValue.Elem().SetUint(uintValue) return pValue.Elem() } func intBinder(val string, typ reflect.Type) reflect.Value { if len(val) == 0 { return reflect.Zero(typ) } intValue, err := strconv.ParseInt(val, 10, 64) if err != nil { return reflect.Zero(typ) } pValue := reflect.New(typ) pValue.Elem().SetInt(intValue) return pValue.Elem() } func floatBinder(val string, typ reflect.Type) reflect.Value { if len(val) == 0 { return reflect.Zero(typ) } floatValue, err := strconv.ParseFloat(val, 64) if err != nil { return reflect.Zero(typ) } pValue := reflect.New(typ) pValue.Elem().SetFloat(floatValue) return pValue.Elem() } func boolBinder(val string, typ reflect.Type) reflect.Value { v := strings.TrimSpace(strings.ToLower(val)) switch v { case "true": return reflect.ValueOf(true) } // Return false by default. return reflect.ValueOf(false) } func timeBinder(val string, typ reflect.Type) reflect.Value { for _, f := range TimeFormats { if f == "" { continue } if strings.Contains(f, "07") || strings.Contains(f, "MST") { if r, err := time.Parse(f, val); err == nil { return reflect.ValueOf(r) } } else { if r, err := time.ParseInLocation(f, val, time.Local); err == nil { return reflect.ValueOf(r) } } } if unixInt, err := strconv.ParseInt(val, 10, 64); err == nil { return reflect.ValueOf(time.Unix(unixInt, 0)) } return reflect.Zero(typ) } func pointerBinder(val string, typ reflect.Type) reflect.Value { if len(val) == 0 { return reflect.Zero(typ) } v := BindValue(val, typ.Elem()) p := reflect.New(v.Type()).Elem() p.Set(v) return p.Addr() } func sliceBinder(vals []string, typ reflect.Type) reflect.Value { slices := reflect.MakeSlice(typ, 0, len(vals)) for i := 0; i < len(vals); i++ { val := BindValue(vals[i], typ.Elem()) slices = reflect.Append(slices, val.Convert(typ.Elem())) } return slices } const ( // DefaultDateFormat day DefaultDateFormat = "2006-01-02" // DefaultDatetimeFormat minute DefaultDatetimeFormat = "2006-01-02 15:0" // DefaultDatetimeFormatSecond second DefaultDatetimeFormatSecond = "2006-01-02 15:04:05" ) // BindValue string to specified type func BindValue(val string, typ reflect.Type) reflect.Value { binder, ok := TypeBinders[typ] if !ok { binder, ok = KindBinders[typ.Kind()] if !ok { // WARN.Println("no binder for type:", typ) // TODO slice | struct return reflect.Zero(typ) } } return binder(val, typ) } type binder func(string, reflect.Type) reflect.Value var ( // TimeFormats supported time formats, also support unix time and time.RFC3339. TimeFormats []string // TypeBinders bind type TypeBinders = make(map[reflect.Type]binder) // KindBinders bind kind KindBinders = make(map[reflect.Kind]binder) ) func init() { KindBinders[reflect.Int] = intBinder KindBinders[reflect.Int8] = intBinder KindBinders[reflect.Int16] = intBinder KindBinders[reflect.Int32] = intBinder KindBinders[reflect.Int64] = intBinder KindBinders[reflect.Uint] = uintBinder KindBinders[reflect.Uint8] = uintBinder KindBinders[reflect.Uint16] = uintBinder KindBinders[reflect.Uint32] = uintBinder KindBinders[reflect.Uint64] = uintBinder KindBinders[reflect.Float32] = floatBinder KindBinders[reflect.Float64] = floatBinder KindBinders[reflect.String] = stringBinder KindBinders[reflect.Bool] = boolBinder KindBinders[reflect.Ptr] = pointerBinder TypeBinders[reflect.TypeOf(time.Time{})] = timeBinder TimeFormats = append(TimeFormats, DefaultDateFormat, DefaultDatetimeFormat, DefaultDatetimeFormatSecond, time.RFC3339) }
binder.go
0.580947
0.44071
binder.go
starcoder
package vector import ( "math" ) // IVector is the interface of Vector class. type IVector interface { Len() int GetAt(int) float64 SetAt(int, float64) } // Vector class implements IVector interface. // Internally, it stores data into a float64 slice. type Vector struct { vec []float64 } // New creates a vector based on arguments. func New(args ...float64) IVector { v := new(Vector) v.vec = make([]float64, len(args)) for i, e := range args { v.SetAt(i, e) } return v } // WithSize creates a zero-based vector with specific size. func WithSize(size int) IVector { v := new(Vector) v.vec = make([]float64, size) for i := 0; i < size; i++ { v.SetAt(i, 0.0) } return v } // FromArray creates a vector from float64 slice. func FromArray(arr []float64) IVector { v := new(Vector) v.vec = make([]float64, len(arr)) for i, e := range arr { v.SetAt(i, e) } return v } // Len returns the length of the vector. Compare it with Magnitude. func (v *Vector) Len() int { return len(v.vec) } // GetAt returns the value of the vector at index i. func (v *Vector) GetAt(i int) float64 { if i < 0 || i >= v.Len() { panic("Index out of range") } return v.vec[i] } // SetAt sets the value of the vector at index i. func (v *Vector) SetAt(i int, data float64) { if i < 0 || i >= v.Len() { panic("Index out of range") } v.vec[i] = data } // Magnitude returns the magnitude of a vector. func Magnitude(v IVector) float64 { temp := Map(v, func(n float64) float64 { return math.Pow(n, 2) }) sum := Reduce(temp, func(a float64, b float64) float64 { return a + b }) return math.Sqrt(sum) } // Sort sorts a vector. func Sort(v IVector) IVector { if v.Len() == 0 { return v } arr := make([]float64, 1) arr[0] = v.GetAt(0) for i := 1; i < v.Len(); i++ { inserted := false for j := 0; j < len(arr); j++ { if v.GetAt(i) < arr[j] { if j == 0 { arr = append([]float64{v.GetAt(i)}, arr...) } else { arr = append(arr[:j], append([]float64{v.GetAt(i)}, arr[j:]...)...) } inserted = true break } } if !inserted { arr = append(arr, v.GetAt(i)) } } return FromArray(arr) } // Add performs element-wise addition between two vectors. func Add(v1 IVector, v2 IVector) IVector { return Apply(v1, v2, func(a float64, b float64) float64 { return a + b }) } // ScalarAdd adds a vector and a scalar. func ScalarAdd(v IVector, s float64) IVector { return ScalarApply(v, s, func(a float64, b float64) float64 { return a + b }) } // Sub performs element-wise substraction between two vectors. func Sub(v1 IVector, v2 IVector) IVector { return Apply(v1, v2, func(a float64, b float64) float64 { return a - b }) } // ScalarSubFirst substracts a scalar to a vector. func ScalarSubFirst(s float64, v IVector) IVector { return ScalarApply(v, s, func(a float64, b float64) float64 { return b - a }) } // ScalarSubSecond substracts a vector to a scalar. func ScalarSubSecond(v IVector, s float64) IVector { return ScalarApply(v, s, func(a float64, b float64) float64 { return a - b }) } // Mul performs element-wise multiplication between two vectors. func Mul(v1 IVector, v2 IVector) IVector { return Apply(v1, v2, func(a float64, b float64) float64 { return a * b }) } // ScalarMul performs element-wise multiplication between a vector and a scalar. func ScalarMul(v IVector, s float64) IVector { return ScalarApply(v, s, func(a float64, b float64) float64 { return a * b }) } // Div perfomrms element-wise division. func Div(v1 IVector, v2 IVector) IVector { return Apply(v1, v2, func(a float64, b float64) float64 { return a / b }) } // ScalarDivFirst divides a scalar numerator and a vector denominator. func ScalarDivFirst(s float64, v IVector) IVector { return ScalarApply(v, s, func(a float64, b float64) float64 { return b / a }) } // ScalarDivSecond divides a vector numerator and a scalar denominator. func ScalarDivSecond(v IVector, s float64) IVector { return ScalarApply(v, s, func(a float64, b float64) float64 { return a / b }) } // Pow performs element-wise power. func Pow(v1 IVector, v2 IVector) IVector { return Apply(v1, v2, func(a float64, b float64) float64 { return math.Pow(a, b) }) } // ScalarPowBase return the power of a scalar base against a vector exponent. func ScalarPowBase(s float64, v IVector) IVector { return ScalarApply(v, s, func(a float64, b float64) float64 { return math.Pow(b, a) }) } // ScalarPowExp return the power of a vector base against a scalar exponent. func ScalarPowExp(v IVector, s float64) IVector { return ScalarApply(v, s, func(a float64, b float64) float64 { return math.Pow(a, b) }) } // Dot returns the dot product between two vectors. func Dot(v1 IVector, v2 IVector) float64 { return Reduce(Mul(v1, v2), func(a float64, b float64) float64 { return a + b }) } // Cos returns the cosine value between two vectors. func Cos(v1 IVector, v2 IVector) float64 { return Dot(v1, v2) / (Magnitude(v1) * Magnitude(v2)) } // Map transform a vector into another vector by an user-defined function. func Map(v IVector, f func(float64) float64) IVector { _len := v.Len() out := WithSize(_len) for i := 0; i < _len; i++ { out.SetAt(i, f(v.GetAt(i))) } return out } // Apply applies an user-defined function to two vectors. func Apply(v1 IVector, v2 IVector, f func(float64, float64) float64) IVector { _len := v1.Len() if !(_len == v2.Len()) { panic("Unequal vector size") } out := WithSize(_len) for i := 0; i < _len; i++ { out.SetAt(i, f(v1.GetAt(i), v2.GetAt(i))) } return out } // ScalarApply applies an user-defined function to a vector and a scalar. func ScalarApply(v IVector, s float64, f func(float64, float64) float64) IVector { _len := v.Len() out := WithSize(_len) for i := 0; i < _len; i++ { out.SetAt(i, f(v.GetAt(i), s)) } return out } // Reduce tranforms a vector to a scalar by an user-defined function. func Reduce(v IVector, f func(float64, float64) float64) float64 { _len := v.Len() if _len <= 1 { return v.GetAt(0) } out := v.GetAt(0) for i := 1; i < _len; i++ { out = f(out, v.GetAt(i)) } return out }
vector/float64/vector.go
0.864411
0.673165
vector.go
starcoder
package ast //Written by the generator, do not over write type AnnotatedNodeVisitor interface { VisitAnnotatedNode(n *AnnotatedNode) (Node, error) } type AssignmentNodeVisitor interface { VisitAssignmentNode(n *AssignmentNode) (Node, error) } type BoolOpVisitor interface { VisitBoolOp(n *BoolOp) (Node, error) } type ComparisonVisitor interface { VisitComparison(n *Comparison) (Node, error) } type ConstantVisitor interface { VisitConstant(n *Constant) (Node, error) } type ContinueNodeVisitor interface { VisitContinueNode(n *ContinueNode) (Node, error) } type DeclNodeVisitor interface { VisitDeclNode(n *DeclNode) (Node, error) } type DecoratorNodeVisitor interface { VisitDecoratorNode(n *DecoratorNode) (Node, error) } type DotNodeVisitor interface { VisitDotNode(n *DotNode) (Node, error) } type ExtendsNodeVisitor interface { VisitExtendsNode(n *ExtendsNode) (Node, error) } type FunctionCallNodeVisitor interface { VisitFunctionCallNode(n *FunctionCallNode) (Node, error) } type FunctionDefinitionNodeVisitor interface { VisitFunctionDefinitionNode(n *FunctionDefinitionNode) (Node, error) } type HandleCaseNodeVisitor interface { VisitHandleCaseNode(n *HandleCaseNode) (Node, error) } type IfNodeVisitor interface { VisitIfNode(n *IfNode) (Node, error) } type ImplementsNodeVisitor interface { VisitImplementsNode(n *ImplementsNode) (Node, error) } type ImportNodeVisitor interface { VisitImportNode(n *ImportNode) (Node, error) } type IndexNodeVisitor interface { VisitIndexNode(n *IndexNode) (Node, error) } type InstantiateNodeVisitor interface { VisitInstantiateNode(n *InstantiateNode) (Node, error) } type InternalNodeVisitor interface { VisitInternalNode(n *InternalNode) (Node, error) } type MatchNodeVisitor interface { VisitMatchNode(n *MatchNode) (Node, error) } type MathOpNodeVisitor interface { VisitMathOpNode(n *MathOpNode) (Node, error) } type MethodDefinitionVisitor interface { VisitMethodDefinition(n *MethodDefinition) (Node, error) } type PackageVisitor interface { VisitPackage(n *Package) (Node, error) } type PipeNodeVisitor interface { VisitPipeNode(n *PipeNode) (Node, error) } type ProgramVisitor interface { VisitProgram(n *Program) (Node, error) } type ReturnNodeVisitor interface { VisitReturnNode(n *ReturnNode) (Node, error) } type ShapeNodeVisitor interface { VisitShapeNode(n *ShapeNode) (Node, error) } type SignalNodeVisitor interface { VisitSignalNode(n *SignalNode) (Node, error) } type SliceNodeVisitor interface { VisitSliceNode(n *SliceNode) (Node, error) } type TryNodeVisitor interface { VisitTryNode(n *TryNode) (Node, error) } type TypeNodeVisitor interface { VisitTypeNode(n *TypeNode) (Node, error) } type VarNameVisitor interface { VisitVarName(n *VarName) (Node, error) } type WhenNodeVisitor interface { VisitWhenNode(n *WhenNode) (Node, error) } type GenericVisitor interface { VisitAnyNode(n Node) (Node, error) } type Visitor interface { AnnotatedNodeVisitor AssignmentNodeVisitor BoolOpVisitor ComparisonVisitor ConstantVisitor ContinueNodeVisitor DeclNodeVisitor DecoratorNodeVisitor DotNodeVisitor ExtendsNodeVisitor FunctionCallNodeVisitor FunctionDefinitionNodeVisitor HandleCaseNodeVisitor IfNodeVisitor ImplementsNodeVisitor ImportNodeVisitor IndexNodeVisitor InstantiateNodeVisitor InternalNodeVisitor MatchNodeVisitor MathOpNodeVisitor MethodDefinitionVisitor PackageVisitor PipeNodeVisitor ProgramVisitor ReturnNodeVisitor ShapeNodeVisitor SignalNodeVisitor SliceNodeVisitor TryNodeVisitor TypeNodeVisitor VarNameVisitor WhenNodeVisitor GenericVisitor }
internal/parser/ast/ast_visitors.go
0.504883
0.583737
ast_visitors.go
starcoder
package shunting import ( "strconv" "github.com/metalnem/parsing-algorithms/ast" "github.com/metalnem/parsing-algorithms/parse" "github.com/metalnem/parsing-algorithms/scan" "github.com/pkg/errors" ) type assoc int const ( left assoc = iota right ) type kind int const ( unary kind = iota binary ) type op struct { value string prec int assoc assoc kind kind } var ops = []op{ {"+", 1, left, binary}, {"-", 1, left, binary}, {"*", 2, left, binary}, {"/", 2, left, binary}, {"+", 3, right, unary}, {"-", 3, right, unary}, {"^", 4, right, binary}, } type parser struct { } type state struct { s *scan.Scanner t scan.Token ops []op exprs []ast.Expr } // New creates a new Shunting Yard parser. func New() parse.Parser { return parser{} } func (parser) Parse(input string) (ast.Expr, error) { s := scan.NewScanner(input) t := s.Next() ops := []op{op{}} state := &state{s: s, t: t, ops: ops} if err := state.parseExpr(); err != nil { return nil, err } if state.t.Type != scan.EOF { return nil, errors.Errorf("Expected EOF, got %s", state.t.Value) } return state.exprs[0], nil } func (s *state) parseExpr() error { if err := s.parsePrimary(); err != nil { return err } for { op, ok := makeBinary(s.t.Value) if !ok { break } s.push(op) s.t = s.s.Next() if err := s.parsePrimary(); err != nil { return err } } for s.ops[len(s.ops)-1].prec > 0 { s.pop() } return nil } func (s *state) parsePrimary() error { if s.t.Type == scan.Number { val, err := strconv.ParseFloat(s.t.Value, 64) if err != nil { return errors.Errorf("Expected number, got %s", s.t.Value) } s.exprs = append(s.exprs, &ast.Number{Value: val}) s.t = s.s.Next() return nil } if s.t.Type == scan.LeftParen { s.ops = append(s.ops, op{}) s.t = s.s.Next() if err := s.parseExpr(); err != nil { return err } if s.t.Type != scan.RightParen { return errors.Errorf("Expected right paren, got %s", s.t.Value) } s.ops = s.ops[:len(s.ops)-1] s.t = s.s.Next() return nil } if op, ok := makeUnary(s.t.Value); ok { s.push(op) s.t = s.s.Next() if err := s.parsePrimary(); err != nil { return err } return nil } return errors.Errorf("Expected expression, got %s", s.t.Value) } func (s *state) push(op op) { for greater(s.ops[len(s.ops)-1], op) { s.pop() } s.ops = append(s.ops, op) } func (s *state) pop() { op := s.ops[len(s.ops)-1] s.ops = s.ops[:len(s.ops)-1] if op.kind == binary { y := s.exprs[len(s.exprs)-1] s.exprs = s.exprs[:len(s.exprs)-1] x := s.exprs[len(s.exprs)-1] s.exprs[len(s.exprs)-1] = &ast.BinaryExpr{Op: op.value, X: x, Y: y} } else { x := s.exprs[len(s.exprs)-1] s.exprs[len(s.exprs)-1] = &ast.UnaryExpr{Op: op.value, X: x} } } func makeUnary(s string) (op, bool) { return makeOp(s, unary) } func makeBinary(s string) (op, bool) { return makeOp(s, binary) } func makeOp(s string, kind kind) (op, bool) { for _, op := range ops { if op.value == s && op.kind == kind { return op, true } } return op{}, false } func greater(x, y op) bool { if x.kind == binary && y.kind == binary { return x.prec > y.prec || (x.assoc == left && x.prec == y.prec) } if x.kind == unary && y.kind == binary { return x.prec >= y.prec } return false }
parse/shunting/shunting.go
0.620392
0.464841
shunting.go
starcoder
package gomfa func Ldsun(p *[3]float64, e *[3]float64, em float64, p1 *[3]float64) { /* ** - - - - - - ** L d s u n ** - - - - - - ** ** Deflection of starlight by the Sun. ** ** Given: ** p *[3] float64 direction from observer to star (unit vector) ** e *[3] float64 direction from Sun to observer (unit vector) ** em float64 distance from Sun to observer (au) ** ** Returned: ** p1 *[3] float64 observer to deflected star (unit vector) ** ** Notes: ** ** 1) The source is presumed to be sufficiently distant that its ** directions seen from the Sun and the observer are essentially ** the same. ** ** 2) The deflection is restrained when the angle between the star and ** the center of the Sun is less than a threshold value, falling to ** zero deflection for zero separation. The chosen threshold value ** is within the solar limb for all solar-system applications, and ** is about 5 arcminutes for the case of a terrestrial observer. ** ** 3) The arguments p and p1 can be the same array. ** ** Called: ** Ld light deflection by a solar-system body ** ** This revision: 2016 June 16 */ var em2, dlim float64 /* Deflection limiter (smaller for distant observers). */ em2 = em * em if em2 < 1.0 { em2 = 1.0 } dlim = 1e-6 if em2 > 1.0 { dlim = 1e-6 / em2 } /* Apply the deflection. */ Ld(1.0, p, p, e, em, dlim, p1) /* Finished. */ } /*---------------------------------------------------------------------- ** ** ** Copyright (C) 2021, <NAME> ** All rights reserved. ** ** This library is derived, with permission, from the International ** Astronomical Union's "Standards of Fundamental Astronomy" library, ** available from http://www.iausofa.org. ** ** The GOMFA version is intended to retain identical functionality to ** the SOFA library, but made distinct through different namespaces and ** file names, as set out in the SOFA license conditions. The SOFA ** original has a role as a reference standard for the IAU and IERS, ** and consequently redistribution is permitted only in its unaltered ** state. The GOMFA version is not subject to this restriction and ** therefore can be included in distributions which do not support the ** concept of "read only" software. ** ** Although the intent is to replicate the SOFA API (other than ** replacement of prefix names) and results (with the exception of ** bugs; any that are discovered will be fixed), SOFA is not ** responsible for any errors found in this version of the library. ** ** If you wish to acknowledge the SOFA heritage, please acknowledge ** that you are using a library derived from SOFA, rather than SOFA ** itself. ** ** ** TERMS AND CONDITIONS ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions ** are met: ** ** 1 Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** ** 2 Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** ** 3 Neither the name of the Standards Of Fundamental Astronomy Board, ** the International Astronomical Union nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ** POSSIBILITY OF SUCH DAMAGE. ** */
ldsun.go
0.76986
0.645762
ldsun.go
starcoder
package mangerattack import ( "crypto/sha256" "encoding/hex" "fmt" "log" "math/big" ) // countQueries is a counter to know how many queries were necessary var countQueries int // Constants const ( byteSize = 8 ) // A few useful big.Int : var ( zero = new(big.Int).SetInt64(int64(0)) two = new(big.Int).SetInt64(int64(2)) ) // Oracle is an interface to allow anyone to easily provide its own oracle queries. // The Decrypt function is provided with the modified ciphertext we want the oracle // to be fed with, while the Query function is returning the bool we need to attack. type Oracle interface { // `Decrypt(*big.Int)` function that will send the said big Integer to the oracle Decrypt(*big.Int) // Query() bool will provide your oracle's answer whether the decrypted plaintext is >= B (true, then is has no leading 0 after decryption) or not (false, it has one or more leading zeros after decryption). Query() bool } // tryOracle is a function which "ask the oracle". It uses the same names as the paper. func tryOracle(f, c, e, N *big.Int, ourOracle Oracle) bool { // We increment our counter countQueries++ // We calculate c*f^e mod N, cf Step 1.2 in Manger's article fe := new(big.Int).Exp(f, e, N) cfe := new(big.Int).Mul(c, fe) mcfe := new(big.Int).Mod(cfe, N) // we send the value to our oracle ourOracle.Decrypt(mcfe) // we query our oracle's answer return ourOracle.Query() } // See the 2 modifications made in rsa.go and the file utils.go to get a better understanding. func MangerAttack(toDecrypt string, N, e *big.Int, ourOracle Oracle) string { // We reset the query counter countQueries = 0 // This is the ciphertext we want to decipher bytesToDecipher, _ := hex.DecodeString(toDecrypt) // We take the byte to decipher and cast them as bit integer c := new(big.Int).SetBytes(bytesToDecipher) // We setup k and B as in the paper k := (N.BitLen() + byteSize - 1) / byteSize B := new(big.Int).Exp(two, big.NewInt(int64((k-1)*byteSize)), nil) // Assert and sanity checks: // we assume that 2B < n if new(big.Int).Mul(two, B).Cmp(N) >= 0 { log.Fatalln("Unsupported case: 2B >= N") } // We can now begin the attack, following <NAME> "A Chosen Ciphertext Attack // on RSA Optimal Asymmetric Encryption Padding (OAEP) as Standardized in PKCS #1 v2.0" // article and notation. The steps are direct references to this article, which can be // found at: http://archiv.infsec.ethz.ch/education/fs08/secsem/Manger01.pdf // Step 1 fmt.Println("Starting step 1") stepsFor1 := 0 // 1.1 f1 := new(big.Int).Set(two) // 1.2 for !tryOracle(f1, c, e, N, ourOracle) { // We are sure it returns MSB != 0 or == 0 stepsFor1++ // 1.3a // Then we are still < B, it returned false f1.Mul(two, f1) } // 1.3b // Then MSB != 0, tryOracle returned true, so we are >= B // this implies that f1*m ∈ [B,2B[ fmt.Println("Step 1 finished: f1=", f1, "found in", stepsFor1, "queries") // f12 is the "return value" of the step 1 f12 := new(big.Int).Div(f1, two) // So f1/2 ∈ [B/2,B[ // Step 2 fmt.Println("Starting step 2") stepsFor2 := 0 // 2.1 nB := new(big.Int).Add(N, B) nBB := new(big.Int).Div(nB, B) f2 := new(big.Int).Mul(nBB, f12) // 2.2 for tryOracle(f2, c, e, N, ourOracle) { // 2.3a stepsFor2++ // i.e. we are >= B, tryOracle returned true f2.Add(f2, f12) } // 2.3b // i.e. tryOracle returned false so we are < B // this implies that we have found a f2 such that f2*m ∈ [N,N+B[ fmt.Println("Step 2 finished: f2=", f2, "\n\tfound in ", stepsFor2, "steps.") // Step 3 fmt.Println("Starting step 3, this can take a bit longer than the previous ones") stepsFor3 := 0 // 3.1 mmin, _ := divCeil(N, f2) mmax := new(big.Int).Div(nB, f2) BB := new(big.Int).Mul(two, B) diff := new(big.Int).Sub(mmax, mmin) fmt.Println("\tSanity check : (mmax-mmin)*f2 ~B? Okay if this is 'small': B-(mmax-mmin)*f2=", new(big.Int).Sub(B, new(big.Int).Mul(f2, diff))) for diff.Sub(mmax, mmin).Cmp(zero) > 0 { stepsFor3++ // 3.2 ftmp := new(big.Int).Div(BB, diff) // 3.3 ftmpmmin := new(big.Int).Mul(ftmp, mmin) i := new(big.Int).Div(ftmpmmin, N) // 3.4 iN := new(big.Int).Mul(i, N) f3, _ := divCeil(iN, mmin) // 3.5a iNB := new(big.Int).Add(iN, B) if tryOracle(f3, c, e, N, ourOracle) { // then it wasn't padded, >=B mmin, _ = divCeil(iNB, f3) } else { // 3.5b <B mmax.Div(iNB, f3) } } fmt.Println("Step 3 finished: \n\tfound m=", mmin) fmt.Println("\tfound in ", stepsFor3, "steps") // We now have found m = mmin, we can unpad it: recoveredPlaintext := unpad(k, mmin, sha256.New(), []byte("")) fmt.Printf("And we have recovered:\n\t\t\"%s\"\n", string(recoveredPlaintext)) fmt.Println("\tin ", countQueries, " queries, with k=", k) return string(recoveredPlaintext) }
mangerattack/attack.go
0.557123
0.496216
attack.go
starcoder
package geom import "math" // Withiner is an interface for types that can be determined to be // within a polygon or not. type Withiner interface { Within(Polygonal) WithinStatus } // pointInPolygonal determines whether "pt" is // within any of the polygons in "pg". // adapted from https://rosettacode.org/wiki/Ray-casting_algorithm#Go. // In this version of the algorithm, points that lie on the edge of the polygon // are considered inside. func pointInPolygonal(pt Point, pg Polygonal) (in WithinStatus) { for _, poly := range pg.Polygons() { pgBounds := poly.ringBounds() tempIn := pointInPolygon(pt, poly, pgBounds) if tempIn == OnEdge { return tempIn } else if tempIn == Inside { in = in.invert() } } return in } // WithinStatus gives the status of a point relative to a polygon: whether // it is inside, outside, or on the edge. type WithinStatus int // WithinStatus gives the status of a point relative to a polygon: whether // it is inside, outside, or on the edge. const ( Outside WithinStatus = iota Inside OnEdge ) func (w WithinStatus) invert() WithinStatus { if w == Outside { return Inside } return Outside } // pointInPolygon determines whether "pt" is // within "pg". // adapted from https://rosettacode.org/wiki/Ray-casting_algorithm#Go. // pgBounds is the bounds of each ring in pg. func pointInPolygon(pt Point, pg Polygon, pgBounds []*Bounds) (in WithinStatus) { for i, ring := range pg { if len(ring) < 3 { continue } if !pgBounds[i].Overlaps(NewBoundsPoint(pt)) { continue } // check segment between beginning and ending points if !ring[len(ring)-1].Equals(ring[0]) { if pointOnSegment(pt, ring[len(ring)-1], ring[0]) { return OnEdge } if rayIntersectsSegment(pt, ring[len(ring)-1], ring[0]) { in = in.invert() } } // check the rest of the segments. for i := 1; i < len(ring); i++ { if pointOnSegment(pt, ring[i-1], ring[i]) { return OnEdge } if rayIntersectsSegment(pt, ring[i-1], ring[i]) { in = in.invert() } } } return in } func rayIntersectsSegment(p, a, b Point) bool { if a.Y > b.Y { a, b = b, a } for p.Y == a.Y || p.Y == b.Y { p.Y = math.Nextafter(p.Y, math.Inf(1)) } if p.Y < a.Y || p.Y > b.Y { return false } if a.X > b.X { if p.X >= a.X { return false } if p.X < b.X { return true } } else { if p.X > b.X { return false } if p.X < a.X { return true } } return (p.Y-a.Y)/(p.X-a.X) >= (b.Y-a.Y)/(b.X-a.X) }
within.go
0.741206
0.506347
within.go
starcoder
package parsehtml import ( "strings" "golang.org/x/net/html" ) // Node wraps html.Node so we can define additional convenience methods type Node struct { *html.Node } // Attribute wraps html.Attribute so we can define additional convenience methods type Attribute struct { *html.Attribute } // NodeP represents a boolean predicate function on HTML nodes. type NodeP func(Node) bool // Text returns the concatenation of the contents of all HTML text child nodes // of the given node. func (node Node) Text() string { data := "" node.OnEachChildNode(IsText, func(n Node) error { data = data + n.Data return nil }) return data } // IsText returns true if the given HTML node is a text node. func IsText(node Node) bool { return node.Type == html.TextNode } // HasClass returns a NodeP function that returns true if the HTML node it is passed has a class // attribute with the value of the given name, otherwise false. func HasClass(name string) NodeP { return Attribute{&html.Attribute{"", "class", name}}.IsAttribute } // AttributeIsMember returns true if the given slice of HTML attributes contains the given // attribute, otherwise false. func (attribute Attribute) AttributeIsMember(attributes []html.Attribute) bool { for _, a := range attributes { if a == *attribute.Attribute { return true } } return false } // IsAttribute returns true if the given HTML node has the given attribute, otherwise false. func (attribute Attribute) IsAttribute(node Node) bool { return attribute.AttributeIsMember(node.Attr) } // HasElementName returns a NodeP function that returns true if the HTML node it is passed is an // element node with the given name, otherwise false. func HasElementName(name string) NodeP { return func(node Node) bool { return node.Type == html.ElementNode && node.Data == name } } // OnEachChildNode executes the given process function on each HTML child node of the given node // satisfying the given predicate function, stopping if an error occurs. func (node Node) OnEachChildNode(predicate NodeP, process func(Node) error) error { for c := node.FindChildNode(predicate); c.Node != nil; c = c.FindNextNode(predicate) { if err := process(c); err != nil { return err } } return nil } // FindChildNode returns the first HTML child node of the given node that satisfies the given // predicate function if one exists, otherwise nil. func (node Node) FindChildNode(predicate NodeP) Node { return Node{node.FirstChild}.FindNode(predicate) } // FindNextNode returns the next HTML sibling node of the given node that satisfies the given // predicate function if one exists, otherwise nil. func (node Node) FindNextNode(predicate NodeP) Node { return Node{node.NextSibling}.FindNode(predicate) } // FindNode returns the next HTML sibling node, beginning with `node` itself, that satisfies the // given predicate function if one exists, otherwise nil. func (node Node) FindNode(predicate NodeP) Node { for c := node; c.Node != nil; c = (Node{c.NextSibling}) { if predicate(c) { return c } } return Node{nil} } // NodeIsAll returns the logical conjunction ("and") of the given predicate functions of HTML nodes. func NodeIsAll(predicates ...NodeP) func(Node) bool { return func(node Node) bool { for _, p := range predicates { if !p(node) { return false } } return true } } // InBetween returns the portion of string `s` appearing after the first occurrence of substring // `before` (exclusive), assuming it exists, and before the first occurrence of substring `after` // (exclusive), if it exists. func InBetween(s, before, after string) string { return TrimSince(TrimPast(s, before), after) } // TrimPast returns the portion of string `s` appearing after the first occurrence of substring // `before` (exclusive), assuming it exists. func TrimPast(s, before string) string { return strings.SplitAfterN(s, before, 2)[1] } // TrimSince returns the portion of string `s` appearing before the first occurrence of substring // `after` (exclusive), if it exists, otherwise the entire string. func TrimSince(s, after string) string { return strings.SplitN(s, after, 2)[0] }
src/common/parsehtml/parsehtml.go
0.875946
0.484136
parsehtml.go
starcoder
package template import ( "fmt" "math" "strconv" "github.com/coveooss/gotemplate/v3/collections" ) func toInt(value interface{}) int { // We convert to the string representation to ensure that any type is converted to int return must(strconv.Atoi(fmt.Sprintf("%v", value))).(int) } func toInt64(value interface{}) int64 { // We convert to the string representation to ensure that any type is converted to int64 return must(strconv.ParseInt(fmt.Sprintf("%v", value), 10, 64)).(int64) } func toUnsignedInteger(value interface{}) uint64 { // We convert to the string representation to ensure that any type is converted to uint64 return must(strconv.ParseUint(fmt.Sprintf("%v", value), 10, 64)).(uint64) } func toFloat(value interface{}) float64 { // We convert to the string representation to ensure that any type is converted to float64 return must(strconv.ParseFloat(fmt.Sprintf("%v", value), 64)).(float64) } func toListOfFloats(values iList) (result iList, err error) { if values == nil { return collections.CreateList(), nil } values = convertArgs(nil, values.AsArray()...) result = values.Clone() defer func() { if err = trapError(err, recover()); err != nil { result = nil } }() for i := range result.AsArray() { result.Set(i, toFloat(result.Get(i))) } return } func asFloats(values iList) ([]float64, error) { result, err := toListOfFloats(values) if err != nil { return nil, err } return mustAsFloats(result), nil } func mustAsFloats(values iList) (result []float64) { result = make([]float64, values.Len()) for i := range result { result[i] = values.Get(i).(float64) } return } func process(arg, handler interface{}) (r interface{}, err error) { defer func() { err = trapError(err, recover()) }() arguments := convertArgs(arg) if arguments.Len() == 0 { return } argArray := arguments.AsArray() switch len(argArray) { case 0: r = 0 case 1: r = execute(argArray[0], handler) default: result := arguments.Clone() for i := range result.AsArray() { result.Set(i, execute(result.Get(i), handler)) } r = result } return } func processFloat(arg interface{}, handler func(float64) float64) (r interface{}, err error) { return process(arg, handler) } func processFloat2(a, b interface{}, handler func(float64, float64) float64) (r interface{}, err error) { return processFloat(a, func(a float64) float64 { return handler(a, toFloat(b)) }) } func execute(arg, handler interface{}) interface{} { switch handler := handler.(type) { case func(float64) float64: return simplify(handler(toFloat(arg))) case func(interface{}) interface{}: return handler(arg) case func(float64) (float64, float64): r1, r2 := handler(toFloat(arg)) return []interface{}{r1, r2} default: panic(fmt.Errorf("unknown handler function %v", handler)) } } func convertArgs(arg1 interface{}, args ...interface{}) (result collections.IGenericList) { if arg1 == nil { // There is no first argument, so we isolate it from the other args if len(args) == 0 { return collections.CreateList() } arg1, args = args[0], args[1:] } if len(args) == 0 { // There is a single argument, we try to convert it into a list return collections.AsList(arg1) } if list, err := collections.TryAsList(arg1); err == nil { return list.Create(0, len(args)+1).Append(arg1).Append(args...) } return collections.NewList(arg1).Append(args...) } func simplify(value float64) interface{} { return iif(math.Floor(value) == value, int64(value), value) } func compareNumerics(values []interface{}, useMinFunc bool) interface{} { if len(values) == 0 { return nil } numerics, err := asFloats(collections.AsList(values)) if err != nil { return compareStrings(values, useMinFunc) } result := numerics[0] comp := iif(useMinFunc, math.Min, math.Max).(func(a, b float64) float64) for _, value := range numerics[1:] { result = comp(result, value) } return simplify(result) } func compareStrings(values []interface{}, useMinFunc bool) (result string) { sa := collections.ToStrings(values) result = sa[0] for _, value := range sa[1:] { if (useMinFunc && value < result) || (!useMinFunc && value > result) { result = value } } return result } func generateNumericArray(limit bool, params ...interface{}) (result collections.IGenericList, err error) { defer func() { err = trapError(err, recover()) }() var start, stop float64 var step float64 = 1 var precision int switch len(params) { case 1: start = float64(iif(limit, 1, 0).(int)) stop = toFloat(params[0]) case 3: step = math.Abs(toFloat(params[2])) _, frac := collections.Split2(fmt.Sprintf("%g", step), ".") precision = len(frac) fallthrough case 2: start = toFloat(params[0]) stop = toFloat(params[1]) default: return nil, fmt.Errorf("invalid arguments, must be start [stop] [step]") } if step == 0 { return nil, fmt.Errorf("step cannot be zero") } array := make([]interface{}, 0, int64(math.Abs(stop-start))) forward := stop > start if !forward { step = -step } for current := start; (forward && current <= stop || !forward && current >= stop) && (limit || current != stop); { current = sprigRound(current, precision) array = append(array, simplify(current)) current += step } result = collections.AsList(array) return }
template/math_utilities.go
0.644561
0.452173
math_utilities.go
starcoder
package dataset import ( "sort" "time" ) type ordered interface { time.Time | string } // Indexer holds a unique set of values, and records the order in which they were added. // Currently, it supports string and time.Time data. type Indexer[T ordered] struct { values []T indices map[T]int inOrder bool } // MakeIndexer returns a new indexer func MakeIndexer[T ordered]() *Indexer[T] { return &Indexer[T]{ values: make([]T, 0), indices: make(map[T]int), inOrder: true, } } // GetIndex returns the index of a value (i.e. when that value was added) func (idx Indexer[T]) GetIndex(value T) (index int, found bool) { index, found = idx.indices[value] return } // Count returns the number of values in the Indexer func (idx Indexer[T]) Count() int { return len(idx.values) } // List returns the (sorted) values in the Indexer func (idx *Indexer[T]) List() (values []T) { if !idx.inOrder { sort.Slice(idx.values, func(i, j int) bool { return isLessThan(idx.values[i], idx.values[j]) }) idx.inOrder = true } return idx.values } // Add adds a new value to the Indexer. It returns the index of that value and whether the value was actually added. func (idx *Indexer[T]) Add(value T) (index int, added bool) { var found bool index, found = idx.indices[value] if found { return index, false } added = true index = len(idx.values) idx.indices[value] = index if idx.inOrder && index > 0 { idx.inOrder = !isLessThan(value, idx.values[index-1]) } idx.values = append(idx.values, value) return } // Copy returns a copy of the Indexer func (idx Indexer[T]) Copy() (clone *Indexer[T]) { clone = &Indexer[T]{ values: make([]T, len(idx.values)), indices: make(map[T]int), } copy(clone.values, idx.values) for key, val := range idx.indices { clone.indices[key] = val } return } func isLessThan[T ordered](a, b T) (isLess bool) { // this works around the fact that we can't type switch on T var x interface{} = a var y interface{} = b switch (x).(type) { case string: isLess = x.(string) < y.(string) case time.Time: isLess = x.(time.Time).Before(y.(time.Time)) } return }
dataset/indexer.go
0.706697
0.518485
indexer.go
starcoder
package vec3 import ( "math" ) // Vec3 defines a 3-dimension vector type Vec3 struct { I float64 J float64 K float64 } // New returns a new Vec3 pointer func New(i float64, j float64, k float64) *Vec3 { return &Vec3{i, j, k} } // Add takes a vec3 transforming v1 by adding their dimensions func (v1 *Vec3) Add(v2 Vec3) { v1.I += v2.I v1.J += v2.J v1.K += v2.K } // Add takes two vec3 returning a new vec3 whose dimensions are equal to the sum of the given vec3 dimensions func Add(v1 Vec3, v2 Vec3) *Vec3 { return &Vec3{v1.I + v2.I, v1.J + v2.J, v1.K + v2.K} } // Dot takes a vec3 and returns the dot product of the two vectors func (v1 Vec3) Dot(v2 Vec3) float64 { return Dot(v1, v2) } // Dot takes two vec3 and returns the dot product of the two vec3 func Dot(v1 Vec3, v2 Vec3) float64 { return v1.I*v2.I + v1.J*v2.J + v1.K*v2.K } // Magnitude returns the magnitude of a vec3 func (v1 Vec3) Magnitude() float64 { return Magnitude(v1) } // Magnitude takes a vec3 and returns its magnitude func Magnitude(v Vec3) float64 { return math.Sqrt(Dot(v, v)) } // MirrorI transforms v by mirroring its I-Dimension func (v1 *Vec3) MirrorI() { v1.I = -v1.I } // MirrorI takes a Vec3 and mirrors its I-dimension returning a new Vec3 func MirrorI(v Vec3) *Vec3 { return &Vec3{-v.I, v.J, v.K} } // MirrorJ transforms v by mirroring its J-Dimension func (v1 *Vec3) MirrorJ() { v1.J = -v1.J } // MirrorJ takes a Vec3 and mirrors its J-dimension returning a new Vec3 func MirrorJ(v Vec3) *Vec3 { return &Vec3{v.I, -v.J, v.K} } // MirrorK transforms v by mirroring its K-Dimension func (v1 *Vec3) MirrorK() { v1.K = -v1.K } // MirrorK takes a Vec3 and mirrors its K-dimension returning a new Vec3 func MirrorK(v Vec3) *Vec3 { return &Vec3{v.I, v.J, -v.K} } // Mirror transforms v by mirroring all of its dimensions func (v1 *Vec3) Mirror() { v1.MirrorI() v1.MirrorJ() v1.MirrorK() } // Mirror takes a Vec3 and mirrors all of its dimensions, returning a new Vec3 func Mirror(v Vec3) *Vec3 { return &Vec3{-v.I, -v.J, -v.K} } // Scale scales v by an s amount func (v1 *Vec3) Scale(s float64) { v1.I *= s v1.J *= s v1.K *= s } // Scale scales a given Vec3 by an s amount, returning a new Vec3 func Scale(v Vec3, s float64) *Vec3 { return &Vec3{v.I * s, v.J * s, v.K * s} } // Sum takes a Vec3 and adds it to the underlying Vec3 transforming it func (v1 *Vec3) Sum(v2 Vec3) { v1.I += v2.I v1.J += v2.J v1.K += v2.K } // Sum takes two Vec3 and returns their sum as a new Vec3 func Sum(v1 Vec3, v2 Vec3) *Vec3 { return &Vec3{v1.I + v2.I, v1.J + v2.J, v1.K + v2.K} } // Unit tranforms a Vec3 into a unit vector func (v1 *Vec3) Unit() { m := Magnitude(*v1) v1.I /= m v1.J /= m v1.K /= m } // Unit takes a Vec3 and returns a unit vector func Unit(v Vec3) *Vec3 { m := Magnitude(v) return &Vec3{v.I / m, v.J / m, v.K / m} } // Angle calculates the angle between two vec3 func (v1 Vec3) Angle(v2 Vec3) float64 { return Angle(v1, v2) } // Angle takes two Vec2 ant calculates the angle (in radians) between them func Angle(v1 Vec3, v2 Vec3) float64 { return math.Acos(Dot(v1, v2) / (Magnitude(v1) * Magnitude(v2))) }
vec3/vec3.go
0.934649
0.521654
vec3.go
starcoder
package bzone import ( "math" ) import vec "github.com/tflovorn/scExplorer/vector" type BzFunc func(k vec.Vector) float64 type bzConsumer func(next, total float64) float64 // Sum values of fn over all Brillouin zone points. // Uses Kahan summation algorithm for increased accuracy. func Sum(pointsPerSide int, dimension int, fn BzFunc) float64 { c := 0.0 add := func(next, total float64) float64 { // add next to total; c holds error compensation information y := next - c t := total + y c = (t - total) - y return t } return bzReduce(add, 0.0, pointsPerSide, dimension, fn) } // Average = Sum / (total number of points) func Avg(pointsPerSide int, dimension int, fn BzFunc) float64 { N := math.Pow(float64(pointsPerSide), float64(dimension)) return Sum(pointsPerSide, dimension, fn) / N } // Find the minimum of fn over all Brillouin zone points. func Min(pointsPerSide int, dimension int, fn BzFunc) float64 { minimum := func(next, min float64) float64 { if next < min { return next } return min } return bzReduce(minimum, math.MaxFloat64, pointsPerSide, dimension, fn) } // Iterate over the Brillouin zone, accumulating the values of fn with combine. // Dev note (TODO?): An interface for point generators could be created to // allow for dependency injection here to replace bzPoints with an arbitrary // point generator. By doing this we could treat symmetric functions // differently (more efficiently). This would also allow testing bzReduce // independently of bzPoints. func bzReduce(combine bzConsumer, start float64, L, d int, fn BzFunc) float64 { points := bzPoints(L, d) total := start for i := 0; i < len(points); i++ { k := points[i] total = combine(fn(k), total) } return total } var pointsCache map[int]map[int][]vec.Vector = make(map[int]map[int][]vec.Vector) // Produce a a slice of vectors whose values cover each first Brillouin zone // point once. func bzPoints(L, d int) []vec.Vector { cachedL, okL := pointsCache[L] if okL { cachedD, okD := cachedL[d] if okD { return cachedD } } else { pointsCache[L] = make(map[int][]vec.Vector) } points := make([]vec.Vector, pow(L, d)) // start is the minumum value of any component of a point start := -math.Pi // (finish - step) is the maximum value of any component of a point finish := -start // step is the separation between point components step := (finish - start) / float64(L) k := vec.ZeroVector(d) kIndex := make([]int, d) // set initial value for k for i := 0; i < d; i++ { k[i] = start kIndex[i] = 0 } // iterate over Brillouin zone done := false for i := 0; !done; i++ { points[i] = vec.ZeroVector(len(k)) copy(points[i], k) done = bzAdvance(k, kIndex, start, step, L, d) } pointsCache[L][d] = points return points } // Advances k and kIndex to the next value. Returns true on overflow back to // the initial k value. func bzAdvance(k vec.Vector, kIndex []int, start, step float64, L, d int) bool { for i := 0; i < d; i++ { // Check if we need to carry. // To avoid any possible (maybe imagined) risk of // rounding error breaking results, use kIndex instead // of making this comparison as k[i] == finish. carry := kIndex[i] == L if !carry { // Advance k. k[i] += step kIndex[i] += 1 // Break unless advancing k caused us to need // to carry. if kIndex[i] != L { break } } // If we get to here, a carry is required. if i == d-1 { // finished iteration return true } k[i] = start kIndex[i] = 0 } return false } // Return x^y func pow(x, y int) int64 { r := int64(1) for i := 0; i < y; i++ { r *= int64(x) } return r }
bzone/bzone.go
0.672332
0.459743
bzone.go
starcoder
package mappers // TestHelper describes a *testing.T helper. // See: https://golang.org/pkg/testing/#T.Helper type TestHelper interface { Helper() } // AdvancedMap maps a standard logger to an advanced logger interface. type AdvancedMap struct { standardMap t TestHelper } // NewAdvancedMap returns an advanced logger that is mapped via mapper. func NewAdvancedMap(m LevelMapper) *AdvancedMap { var a AdvancedMap if m != nil { a.LevelMapper = m } return &a } // NewAdvancedMapTesting returns an advanced logger that is mapped via mapper. // A TestHelper can be passed that will then be invoked (when not nil) on each // log statement marking that function call as a test helper call and causing // file/line information to be skipped. func NewAdvancedMapTesting(m LevelMapper, t TestHelper) *AdvancedMap { var a AdvancedMap if m != nil { a.LevelMapper = m } a.t = t return &a } // Debug should be used when logging exessive debug info. func (a *AdvancedMap) Debug(v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrint(LevelDebug, v...) } // Debugf works the same as Debug but supports formatting. func (a *AdvancedMap) Debugf(format string, v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrintf(LevelDebug, format, v...) } // Debugln works the same as Debug but supports formatting. func (a *AdvancedMap) Debugln(v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrintln(LevelDebug, v...) } // Info is a general function to log something. func (a *AdvancedMap) Info(v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrint(LevelInfo, v...) } // Infof works the same as Info but supports formatting. func (a *AdvancedMap) Infof(format string, v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrintf(LevelInfo, format, v...) } // Infoln works the same as Info but supports formatting. func (a *AdvancedMap) Infoln(v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrintln(LevelInfo, v...) } // Warn is useful for alerting about something wrong. func (a *AdvancedMap) Warn(v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrint(LevelWarn, v...) } // Warnf works the same as Warn but supports formatting. func (a *AdvancedMap) Warnf(format string, v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrintf(LevelWarn, format, v...) } // Warnln works the same as Warn but supports formatting. func (a *AdvancedMap) Warnln(v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrintln(LevelWarn, v...) } // Error should be used only if real error occures. func (a *AdvancedMap) Error(v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrint(LevelError, v...) } // Errorf works the same as Error but supports formatting. func (a *AdvancedMap) Errorf(format string, v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrintf(LevelError, format, v...) } // Errorln works the same as Error but supports formatting. func (a *AdvancedMap) Errorln(v ...interface{}) { if a.t != nil { a.t.Helper() } a.LevelPrintln(LevelError, v...) }
mappers/advanced.go
0.756178
0.454654
advanced.go
starcoder
package keyvaluestoretest import ( "fmt" "math" "strconv" "strings" "sync" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/ccbrown/keyvaluestore" ) type testBinaryMarshaler struct{} func (testBinaryMarshaler) MarshalBinary() ([]byte, error) { return []byte("bar"), nil } func assertConditionPass(t *testing.T, r keyvaluestore.AtomicWriteResult) { assert.False(t, r.ConditionalFailed()) } func assertConditionFail(t *testing.T, r keyvaluestore.AtomicWriteResult) { assert.True(t, r.ConditionalFailed()) } func TestBackendAtomicWrite(t *testing.T, newBackend func() keyvaluestore.Backend) { b := newBackend() t.Run("Set", func(t *testing.T) { tx := b.AtomicWrite() defer assertConditionPass(t, tx.Set("foo", "bar")) defer assertConditionPass(t, tx.Set("bar", "baz")) ok, err := tx.Exec() assert.NoError(t, err) assert.True(t, ok) tx = b.AtomicWrite() defer assertConditionFail(t, tx.SetNX("foo", "bar")) defer assertConditionPass(t, tx.Set("baz", "qux")) ok, err = tx.Exec() assert.NoError(t, err) assert.False(t, ok) }) t.Run("SetNX", func(t *testing.T) { assert.NoError(t, b.Set("foo", "bar")) _, err := b.Delete("notset") assert.NoError(t, err) _, err = b.Delete("notset2") assert.NoError(t, err) tx := b.AtomicWrite() defer assertConditionFail(t, tx.SetNX("foo", "bar")) ok, err := tx.Exec() assert.NoError(t, err) assert.False(t, ok) tx = b.AtomicWrite() defer assertConditionPass(t, tx.SetNX("notset", "bar")) defer assertConditionPass(t, tx.SetNX("notset2", "bar2")) ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) v, err := b.Get("notset") require.NoError(t, err) assert.Equal(t, "bar", *v) v, err = b.Get("notset2") require.NoError(t, err) assert.Equal(t, "bar2", *v) }) t.Run("SetXX", func(t *testing.T) { assert.NoError(t, b.Set("foo", "bar")) _, err := b.Delete("notset") assert.NoError(t, err) _, err = b.Delete("notset2") assert.NoError(t, err) tx := b.AtomicWrite() defer assertConditionFail(t, tx.SetXX("notset", "bar")) ok, err := tx.Exec() require.NoError(t, err) assert.False(t, ok) tx = b.AtomicWrite() defer assertConditionPass(t, tx.SetXX("foo", "bar")) defer assertConditionFail(t, tx.SetXX("notset2", "bar2")) ok, err = tx.Exec() assert.NoError(t, err) assert.False(t, ok) tx = b.AtomicWrite() defer assertConditionPass(t, tx.SetXX("foo", "bar")) ok, err = tx.Exec() assert.NoError(t, err) assert.True(t, ok) v, err := b.Get("foo") require.NoError(t, err) assert.Equal(t, "bar", *v) }) t.Run("Delete", func(t *testing.T) { assert.NoError(t, b.Set("foo", "bar")) assert.NoError(t, b.Set("deleteme", "bar")) _, err := b.Delete("notset") assert.NoError(t, err) tx := b.AtomicWrite() defer assertConditionFail(t, tx.SetNX("foo", "bar")) tx.Delete("deleteme") ok, err := tx.Exec() require.NoError(t, err) assert.False(t, ok) got, err := b.Get("deleteme") assert.NoError(t, err) assert.NotNil(t, got) tx = b.AtomicWrite() defer assertConditionPass(t, tx.SetNX("notset", "bar")) tx.Delete("deleteme") ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) got, err = b.Get("deleteme") assert.NoError(t, err) assert.Nil(t, got) }) t.Run("DeleteXX", func(t *testing.T) { assert.NoError(t, b.Set("foo", "bar")) assert.NoError(t, b.Set("deleteme", "bar")) _, err := b.Delete("notset") assert.NoError(t, err) tx := b.AtomicWrite() defer assertConditionFail(t, tx.DeleteXX("notset")) tx.Delete("deleteme") ok, err := tx.Exec() require.NoError(t, err) assert.False(t, ok) got, err := b.Get("deleteme") assert.NoError(t, err) assert.NotNil(t, got) tx = b.AtomicWrite() defer assertConditionPass(t, tx.DeleteXX("foo")) tx.Delete("deleteme") ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) got, err = b.Get("deleteme") assert.NoError(t, err) assert.Nil(t, got) }) t.Run("NIncrBy", func(t *testing.T) { assert.NoError(t, b.Set("foo", "bar")) _, err := b.Delete("notset") assert.NoError(t, err) tx := b.AtomicWrite() defer assertConditionFail(t, tx.SetNX("foo", "bar")) tx.NIncrBy("n", 1) ok, err := tx.Exec() require.NoError(t, err) assert.False(t, ok) got, err := b.NIncrBy("n", 0) assert.NoError(t, err) assert.EqualValues(t, 0, got) tx = b.AtomicWrite() defer assertConditionPass(t, tx.SetNX("notset", "baz")) tx.NIncrBy("n", 1) ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) got, err = b.NIncrBy("n", 0) assert.NoError(t, err) require.NotNil(t, got) assert.EqualValues(t, 1, got) }) t.Run("SetEQ", func(t *testing.T) { assert.NoError(t, b.Set("foo", 1)) assert.NoError(t, b.Set("deleteme", "bar")) _, err := b.Delete("notset") assert.NoError(t, err) tx := b.AtomicWrite() defer assertConditionFail(t, tx.SetEQ("foo", 2, 100)) defer assertConditionPass(t, tx.SetNX("notset", "bar")) ok, err := tx.Exec() require.NoError(t, err) assert.False(t, ok) tx = b.AtomicWrite() defer assertConditionPass(t, tx.SetEQ("foo", 2, 1)) defer assertConditionPass(t, tx.SetNX("notset", "bar")) ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) }) t.Run("ZAdd", func(t *testing.T) { assert.NoError(t, b.Set("zsetcond", "foo")) tx := b.AtomicWrite() defer assertConditionFail(t, tx.SetNX("zsetcond", "foo")) defer assertConditionPass(t, tx.ZAdd("zset", "foo", 1.0)) defer assertConditionPass(t, tx.ZAdd("zset", "bar", 2.0)) ok, err := tx.Exec() require.NoError(t, err) assert.False(t, ok) count, err := b.ZCount("zset", 0.0, 10.0) assert.NoError(t, err) assert.Equal(t, 0, count) tx = b.AtomicWrite() defer assertConditionPass(t, tx.ZAdd("zset", "foo", 1.0)) defer assertConditionPass(t, tx.ZAdd("zset", "bar", 2.0)) ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) count, err = b.ZCount("zset", 0.0, 10.0) assert.NoError(t, err) assert.Equal(t, 2, count) t.Run("ZRem", func(t *testing.T) { tx = b.AtomicWrite() defer assertConditionPass(t, tx.ZRem("zset", "foo")) ok, err = tx.Exec() assert.NoError(t, err) assert.True(t, ok) count, err = b.ZCount("zset", 0.0, 10.0) assert.NoError(t, err) assert.Equal(t, 1, count) }) }) t.Run("ZHAdd", func(t *testing.T) { assert.NoError(t, b.Set("zhashcond", "foo")) tx := b.AtomicWrite() defer assertConditionFail(t, tx.SetNX("zhashcond", "foo")) defer assertConditionPass(t, tx.ZHAdd("zhash", "f", "foo", 0.0)) defer assertConditionPass(t, tx.ZHAdd("zhash", "b", "bar", 0.0)) ok, err := tx.Exec() require.NoError(t, err) assert.False(t, ok) count, err := b.ZCount("zhash", 0.0, 10.0) assert.NoError(t, err) assert.Equal(t, 0, count) tx = b.AtomicWrite() defer assertConditionPass(t, tx.ZHAdd("zhash", "f", "foo", 0.0)) defer assertConditionPass(t, tx.ZHAdd("zhash", "b", "bar", 0.0)) ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) count, err = b.ZCount("zhash", 0.0, 10.0) assert.NoError(t, err) assert.Equal(t, 2, count) t.Run("ZHRem", func(t *testing.T) { tx = b.AtomicWrite() defer assertConditionPass(t, tx.ZHRem("zhash", "f")) ok, err = tx.Exec() assert.NoError(t, err) assert.True(t, ok) members, err := b.ZHRangeByLex("zhash", "-", "+", 0) assert.NoError(t, err) assert.Equal(t, []string{"bar"}, members) }) }) t.Run("ZAddNX", func(t *testing.T) { assert.NoError(t, b.ZRem("zset", "foo")) assert.NoError(t, b.ZRem("zset", "bar")) tx := b.AtomicWrite() defer assertConditionPass(t, tx.ZAddNX("zset", "foo", 0.0)) defer assertConditionPass(t, tx.ZAddNX("zset", "bar", 0.0)) ok, err := tx.Exec() require.NoError(t, err) assert.True(t, ok) tx = b.AtomicWrite() defer assertConditionPass(t, tx.ZAddNX("zset", "baz", 0.0)) defer assertConditionFail(t, tx.ZAddNX("zset", "bar", 0.0)) ok, err = tx.Exec() require.NoError(t, err) assert.False(t, ok) tx = b.AtomicWrite() defer assertConditionPass(t, tx.ZAddNX("zset", "baz", 0.0)) defer assertConditionPass(t, tx.ZAddNX("zset", "qux", 0.0)) ok, err = tx.Exec() assert.NoError(t, err) assert.True(t, ok) }) t.Run("SAdd", func(t *testing.T) { assert.NoError(t, b.Set("setcond", "foo")) tx := b.AtomicWrite() defer assertConditionFail(t, tx.SetNX("setcond", "foo")) defer assertConditionPass(t, tx.SAdd("set", "foo", "bar")) ok, err := tx.Exec() assert.NoError(t, err) assert.False(t, ok) members, err := b.SMembers("set") require.NoError(t, err) assert.Empty(t, members) tx = b.AtomicWrite() defer assertConditionPass(t, tx.SAdd("set", "foo", "bar")) ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) members, err = b.SMembers("set") assert.NoError(t, err) assert.Len(t, members, 2) t.Run("SRem", func(t *testing.T) { tx = b.AtomicWrite() defer assertConditionPass(t, tx.SRem("set", "foo")) ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) members, err = b.SMembers("set") assert.NoError(t, err) assert.Len(t, members, 1) }) }) t.Run("HSet", func(t *testing.T) { assert.NoError(t, b.Set("setcond", "foo")) tx := b.AtomicWrite() defer assertConditionFail(t, tx.SetNX("setcond", "foo")) defer assertConditionPass(t, tx.HSet("h", "foo", "bar")) ok, err := tx.Exec() require.NoError(t, err) assert.False(t, ok) v, err := b.HGet("h", "foo") assert.NoError(t, err) assert.Nil(t, v) tx = b.AtomicWrite() defer assertConditionPass(t, tx.HSet("h", "foo", "bar")) ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) v, err = b.HGet("h", "foo") require.NoError(t, err) assert.Equal(t, "bar", *v) }) t.Run("HSetNX", func(t *testing.T) { assert.NoError(t, b.HDel("h", "foo")) assert.NoError(t, b.Set("foo", "x")) tx := b.AtomicWrite() defer assertConditionPass(t, tx.Set("foo", "bar")) defer assertConditionPass(t, tx.HSetNX("h", "foo", "bar")) ok, err := tx.Exec() require.NoError(t, err) assert.True(t, ok) v, err := b.Get("foo") require.NoError(t, err) assert.Equal(t, "bar", *v) tx = b.AtomicWrite() defer assertConditionPass(t, tx.Set("foo", "baz")) defer assertConditionFail(t, tx.HSetNX("h", "foo", "bar")) ok, err = tx.Exec() require.NoError(t, err) assert.False(t, ok) v, err = b.Get("foo") require.NoError(t, err) assert.Equal(t, "bar", *v) }) t.Run("HDel", func(t *testing.T) { assert.NoError(t, b.Set("setcond", "foo")) assert.NoError(t, b.HSet("h", "foo", "bar")) tx := b.AtomicWrite() defer assertConditionFail(t, tx.SetNX("setcond", "foo")) defer assertConditionPass(t, tx.HDel("h", "foo")) ok, err := tx.Exec() require.NoError(t, err) assert.False(t, ok) v, err := b.HGet("h", "foo") require.NoError(t, err) assert.Equal(t, "bar", *v) tx = b.AtomicWrite() defer assertConditionPass(t, tx.HDel("h", "foo")) ok, err = tx.Exec() require.NoError(t, err) assert.True(t, ok) v, err = b.HGet("h", "foo") assert.NoError(t, err) assert.Nil(t, v) }) } func TestBackend(t *testing.T, newBackend func() keyvaluestore.Backend) { t.Run("Set", func(t *testing.T) { t.Run("BinaryMarshaler", func(t *testing.T) { b := newBackend() assert.NoError(t, b.Set("foo", &testBinaryMarshaler{})) v, err := b.Get("foo") require.NotNil(t, v) require.NoError(t, err) assert.Equal(t, "bar", *v) }) }) t.Run("NIncrBy", func(t *testing.T) { b := newBackend() n, err := b.NIncrBy("foo", 2) assert.EqualValues(t, 2, n) assert.NoError(t, err) v, err := b.NIncrBy("foo", 0) require.NotNil(t, v) assert.NoError(t, err) assert.EqualValues(t, 2, v) n, err = b.NIncrBy("foo", -1) assert.EqualValues(t, 1, n) assert.NoError(t, err) v, err = b.NIncrBy("foo", 0) require.NotNil(t, v) assert.NoError(t, err) assert.EqualValues(t, 1, v) }) t.Run("Delete", func(t *testing.T) { b := newBackend() success, err := b.Delete("foo") assert.False(t, success) assert.NoError(t, err) assert.NoError(t, b.Set("foo", "bar")) v, err := b.Get("foo") assert.NotNil(t, v) assert.NoError(t, err) success, err = b.Delete("foo") assert.NoError(t, err) assert.True(t, success) v, err = b.Get("foo") assert.Nil(t, v) assert.NoError(t, err) }) t.Run("SetNX", func(t *testing.T) { b := newBackend() didSet, err := b.SetNX("foo", "bar") assert.True(t, didSet) assert.NoError(t, err) v, err := b.Get("foo") assert.NotNil(t, v) assert.NoError(t, err) didSet, err = b.SetNX("foo", "bar") assert.False(t, didSet) assert.NoError(t, err) }) t.Run("SetXX", func(t *testing.T) { b := newBackend() didSet, err := b.SetXX("foo", "bar") assert.False(t, didSet) assert.NoError(t, err) v, err := b.Get("foo") assert.Nil(t, v) assert.NoError(t, err) assert.NoError(t, b.Set("foo", "x")) didSet, err = b.SetXX("foo", "bar") assert.True(t, didSet) assert.NoError(t, err) v, err = b.Get("foo") require.NotNil(t, v) assert.Equal(t, "bar", *v) assert.NoError(t, err) }) t.Run("SAdd", func(t *testing.T) { b := newBackend() assert.NoError(t, b.SAdd("foo", "bar")) members, err := b.SMembers("foo") assert.Equal(t, []string{"bar"}, members) assert.NoError(t, err) assert.NoError(t, b.SAdd("foo", "baz")) assert.NoError(t, b.SAdd("foo", "baz")) members, err = b.SMembers("foo") assert.ElementsMatch(t, []string{"bar", "baz"}, members) assert.NoError(t, err) }) t.Run("SRem", func(t *testing.T) { b := newBackend() assert.NoError(t, b.SAdd("foo", "a", "b", "c", "d")) members, err := b.SMembers("foo") assert.ElementsMatch(t, []string{"a", "b", "c", "d"}, members) assert.NoError(t, err) assert.NoError(t, b.SRem("foo", "a", "b")) members, err = b.SMembers("foo") assert.ElementsMatch(t, []string{"c", "d"}, members) assert.NoError(t, err) t.Run("Empty", func(t *testing.T) { b := newBackend() assert.NoError(t, b.SRem("foo", "x")) }) }) t.Run("HGet", func(t *testing.T) { b := newBackend() v, err := b.HGet("foo", "bar") assert.NoError(t, err) assert.Nil(t, v) assert.NoError(t, b.HSet("foo", "bar", "baz")) v, err = b.HGet("foo", "bar") require.NoError(t, err) assert.Equal(t, *v, "baz") }) t.Run("HDel", func(t *testing.T) { b := newBackend() assert.NoError(t, b.HDel("foo", "bar")) assert.NoError(t, b.HSet("foo", "bar", "baz")) v, err := b.HGet("foo", "bar") assert.NoError(t, err) assert.NotNil(t, v) assert.NoError(t, b.HDel("foo", "bar")) v, err = b.HGet("foo", "bar") assert.NoError(t, err) assert.Nil(t, v) }) t.Run("HGetAll", func(t *testing.T) { b := newBackend() assert.NoError(t, b.HSet("foo", "bar", "baz", keyvaluestore.KeyValue{"baz", "qux"})) m, err := b.HGetAll("foo") assert.NoError(t, err) assert.Len(t, m, 2) assert.Equal(t, "baz", m["bar"]) assert.Equal(t, "qux", m["baz"]) }) t.Run("AtomicWrite", func(t *testing.T) { TestBackendAtomicWrite(t, newBackend) }) t.Run("Batch", func(t *testing.T) { t.Run("Get", func(t *testing.T) { b := newBackend() assert.NoError(t, b.Set("foo", "bar")) assert.NoError(t, b.Set("foo2", "bar2")) batch := b.Batch() get := batch.Get("foo") get2 := batch.Get("foo2") get3 := batch.Get("foo3") assert.NoError(t, batch.Exec()) v, err := get.Result() require.NoError(t, err) assert.Equal(t, "bar", *v) v, err = get2.Result() require.NoError(t, err) assert.Equal(t, "bar2", *v) v, err = get3.Result() assert.Nil(t, v) assert.NoError(t, err) }) t.Run("SMembers", func(t *testing.T) { b := newBackend() assert.NoError(t, b.SAdd("set", "a")) assert.NoError(t, b.SAdd("set", "b")) batch := b.Batch() smembers := batch.SMembers("set") require.NoError(t, batch.Exec()) members, _ := smembers.Result() assert.ElementsMatch(t, []string{"a", "b"}, members) }) t.Run("Set", func(t *testing.T) { b := newBackend() batch := b.Batch() batch.Set("foo", "a") batch.Set("foo", "b") require.NoError(t, batch.Exec()) foo, err := b.Get("foo") require.NotNil(t, foo) assert.Equal(t, "b", *foo) assert.NoError(t, err) }) t.Run("Delete", func(t *testing.T) { b := newBackend() batch := b.Batch() batch.Set("foo", "a") batch.Delete("foo") require.NoError(t, batch.Exec()) foo, err := b.Get("foo") assert.Nil(t, foo) assert.NoError(t, err) batch = b.Batch() batch.Delete("foo") require.NoError(t, batch.Exec()) foo, err = b.Get("foo") assert.Nil(t, foo) assert.NoError(t, err) assert.NoError(t, b.Set("foo", "a")) batch = b.Batch() batch.Delete("foo") require.NoError(t, batch.Exec()) foo, err = b.Get("foo") assert.Nil(t, foo) assert.NoError(t, err) }) t.Run("ZAdd", func(t *testing.T) { b := newBackend() batch := b.Batch() batch.ZAdd("foo", "a", 0.0) batch.ZAdd("foo", "b", 10.0) require.NoError(t, batch.Exec()) members, err := b.ZRangeByScore("foo", 0.0, 100.0, 0) assert.Equal(t, []string{"a", "b"}, members) assert.NoError(t, err) batch = b.Batch() batch.ZAdd("foo", "a", 5.0) batch.ZAdd("foo", "a", 20.0) require.NoError(t, batch.Exec()) members, err = b.ZRangeByScore("foo", 0.0, 100.0, 0) assert.Equal(t, []string{"b", "a"}, members) assert.NoError(t, err) }) t.Run("ZScore", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZAdd("foo", "a", 0.0)) assert.NoError(t, b.ZAdd("foo", "b", 10.0)) batch := b.Batch() rA := batch.ZScore("foo", "a") rB := batch.ZScore("foo", "b") absent := batch.ZScore("foo", "absent") require.NoError(t, batch.Exec()) score, _ := rA.Result() assert.Equal(t, 0.0, *score) score, _ = rB.Result() assert.Equal(t, 10.0, *score) score, _ = absent.Result() assert.Nil(t, score) }) }) t.Run("SetEQ", func(t *testing.T) { t.Run("Ok", func(t *testing.T) { b := newBackend() assert.NoError(t, b.Set("foo", "bar")) success, err := b.SetEQ("foo", "baz", "bar") assert.True(t, success) assert.NoError(t, err) v, err := b.Get("foo") require.NoError(t, err) assert.Equal(t, "baz", *v) }) t.Run("Fail", func(t *testing.T) { b := newBackend() assert.NoError(t, b.Set("foo", "bar")) success, err := b.SetEQ("foo", "qux", "baz") assert.False(t, success) assert.NoError(t, err) v, err := b.Get("foo") require.NoError(t, err) assert.Equal(t, "bar", *v) }) }) t.Run("ZRem", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZAdd("foo", "a", 0.0)) assert.NoError(t, b.ZAdd("foo", "b", 0.0)) members, err := b.ZRangeByLex("foo", "-", "+", 0) assert.NoError(t, err) assert.Equal(t, []string{"a", "b"}, members) assert.NoError(t, b.ZRem("foo", "a")) members, err = b.ZRangeByLex("foo", "-", "+", 0) assert.NoError(t, err) assert.Equal(t, []string{"b"}, members) }) t.Run("ZHRem", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZHAdd("foo", "f", "foo", 1.0)) assert.NoError(t, b.ZHAdd("foo", "b", "bar", 2.0)) members, err := b.ZHRangeByScore("foo", 0.0, 10.0, 0) assert.NoError(t, err) assert.Equal(t, []string{"foo", "bar"}, members) assert.NoError(t, b.ZHRem("foo", "b")) members, err = b.ZHRangeByLex("foo", "-", "+", 0) assert.NoError(t, err) assert.Equal(t, []string{"foo"}, members) }) t.Run("ZRangeByScore", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZAdd("foo", "-2", -2.0)) assert.NoError(t, b.ZAdd("foo", "-1", -1.0)) assert.NoError(t, b.ZAdd("foo", "-0.5", -0.5)) assert.NoError(t, b.ZAdd("foo", "0", 0.0)) assert.NoError(t, b.ZAdd("foo", "0.5", 0.5)) assert.NoError(t, b.ZAdd("foo", "0.5b", 0.5)) assert.NoError(t, b.ZAdd("foo", "1", 1.0)) assert.NoError(t, b.ZAdd("foo", "2", 2.0)) t.Run("MinMax", func(t *testing.T) { members, err := b.ZRangeByScore("foo", -0.5, 1.0, 0) assert.NoError(t, err) assert.Equal(t, []string{"-0.5", "0", "0.5", "0.5b", "1"}, members) }) t.Run("-Inf", func(t *testing.T) { members, err := b.ZRangeByScore("foo", math.Inf(-1), 1, 0) assert.NoError(t, err) assert.Equal(t, []string{"-2", "-1", "-0.5", "0", "0.5", "0.5b", "1"}, members) }) t.Run("+Inf", func(t *testing.T) { members, err := b.ZRangeByScore("foo", -0.5, math.Inf(1), 0) assert.NoError(t, err) assert.Equal(t, []string{"-0.5", "0", "0.5", "0.5b", "1", "2"}, members) }) t.Run("Rev", func(t *testing.T) { t.Run("MinMax", func(t *testing.T) { members, err := b.ZRevRangeByScore("foo", -0.5, 1.0, 0) assert.NoError(t, err) assert.Equal(t, []string{"1", "0.5b", "0.5", "0", "-0.5"}, members) }) t.Run("-Inf", func(t *testing.T) { members, err := b.ZRevRangeByScore("foo", math.Inf(-1), 1, 0) assert.NoError(t, err) assert.Equal(t, []string{"1", "0.5b", "0.5", "0", "-0.5", "-1", "-2"}, members) }) t.Run("+Inf", func(t *testing.T) { members, err := b.ZRevRangeByScore("foo", -0.5, math.Inf(1), 0) assert.NoError(t, err) assert.Equal(t, []string{"2", "1", "0.5b", "0.5", "0", "-0.5"}, members) }) }) t.Run("Update", func(t *testing.T) { assert.NoError(t, b.ZAdd("update-test", "foo", 2.0)) members, err := b.ZRangeByScore("update-test", 1.5, 2.5, 0) assert.NoError(t, err) assert.Equal(t, []string{"foo"}, members) assert.NoError(t, b.ZAdd("update-test", "foo", 3.0)) members, err = b.ZRangeByScore("update-test", 1.5, 2.5, 0) assert.NoError(t, err) assert.Empty(t, members) members, err = b.ZRangeByScore("update-test", 2.5, 3.5, 0) assert.NoError(t, err) assert.Equal(t, []string{"foo"}, members) }) }) t.Run("ZHRangeByScore", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZHAdd("foo", "a", "-2", -2.0)) assert.NoError(t, b.ZHAdd("foo", "b", "-1", -1.0)) assert.NoError(t, b.ZHAdd("foo", "c", "-0.5", -0.5)) assert.NoError(t, b.ZHAdd("foo", "d", "0", 0.0)) assert.NoError(t, b.ZHAdd("foo", "e", "0.5", 0.5)) assert.NoError(t, b.ZHAdd("foo", "f", "0.5b", 0.5)) assert.NoError(t, b.ZHAdd("foo", "g", "1", 1.0)) assert.NoError(t, b.ZHAdd("foo", "h", "2", 2.0)) t.Run("MinMax", func(t *testing.T) { members, err := b.ZHRangeByScore("foo", -0.5, 1.0, 0) assert.NoError(t, err) assert.Equal(t, []string{"-0.5", "0", "0.5", "0.5b", "1"}, members) }) t.Run("-Inf", func(t *testing.T) { members, err := b.ZHRangeByScore("foo", math.Inf(-1), 1, 0) assert.NoError(t, err) assert.Equal(t, []string{"-2", "-1", "-0.5", "0", "0.5", "0.5b", "1"}, members) }) t.Run("+Inf", func(t *testing.T) { members, err := b.ZHRangeByScore("foo", -0.5, math.Inf(1), 0) assert.NoError(t, err) assert.Equal(t, []string{"-0.5", "0", "0.5", "0.5b", "1", "2"}, members) }) t.Run("Rev", func(t *testing.T) { t.Run("MinMax", func(t *testing.T) { members, err := b.ZHRevRangeByScore("foo", -0.5, 1.0, 0) assert.NoError(t, err) assert.Equal(t, []string{"1", "0.5b", "0.5", "0", "-0.5"}, members) }) t.Run("-Inf", func(t *testing.T) { members, err := b.ZHRevRangeByScore("foo", math.Inf(-1), 1, 0) assert.NoError(t, err) assert.Equal(t, []string{"1", "0.5b", "0.5", "0", "-0.5", "-1", "-2"}, members) }) t.Run("+Inf", func(t *testing.T) { members, err := b.ZHRevRangeByScore("foo", -0.5, math.Inf(1), 0) assert.NoError(t, err) assert.Equal(t, []string{"2", "1", "0.5b", "0.5", "0", "-0.5"}, members) }) }) // to make migrations easier, zhrange functions should also return zadded members since it // doesn't really cost us anything t.Run("ZAddMigration", func(t *testing.T) { assert.NoError(t, b.ZAdd("zaddtest", "a", 0.0)) assert.NoError(t, b.ZHAdd("zaddtest", "b", "bob", 0.0)) assert.NoError(t, b.ZAdd("zaddtest", "c", 0.0)) assert.NoError(t, b.ZHAdd("zaddtest", "d", "dan", 0.0)) members, err := b.ZHRangeByScore("zaddtest", -0.5, 1.0, 0) assert.NoError(t, err) assert.Equal(t, []string{"a", "bob", "c", "dan"}, members) }) t.Run("Update", func(t *testing.T) { assert.NoError(t, b.ZHAdd("update-test", "f", "foo", 2.0)) members, err := b.ZHRangeByScore("update-test", 1.5, 2.5, 0) assert.NoError(t, err) assert.Equal(t, []string{"foo"}, members) assert.NoError(t, b.ZHAdd("update-test", "f", "bar", 3.0)) members, err = b.ZHRangeByScore("update-test", 1.5, 2.5, 0) assert.NoError(t, err) assert.Empty(t, members) members, err = b.ZHRangeByScore("update-test", 2.5, 3.5, 0) assert.NoError(t, err) assert.Equal(t, []string{"bar"}, members) }) }) t.Run("ZRangeByLex", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZAdd("foo", "a", 0.0)) assert.NoError(t, b.ZAdd("foo", "b", 0.0)) assert.NoError(t, b.ZAdd("foo", "c", 0.0)) assert.NoError(t, b.ZAdd("foo", "d", 0.0)) t.Run("Inf", func(t *testing.T) { members, err := b.ZRangeByLex("foo", "-", "+", 0) assert.NoError(t, err) assert.Equal(t, []string{"a", "b", "c", "d"}, members) }) t.Run("MinGreaterThanMax", func(t *testing.T) { members, err := b.ZRangeByLex("foo", "(d", "(a", 0) assert.NoError(t, err) assert.Empty(t, members) }) t.Run("MinMaxExclusive", func(t *testing.T) { members, err := b.ZRangeByLex("foo", "(a", "(d", 0) assert.NoError(t, err) assert.Equal(t, []string{"b", "c"}, members) }) t.Run("MinMaxInclusive", func(t *testing.T) { members, err := b.ZRangeByLex("foo", "[a", "[d", 0) assert.NoError(t, err) assert.Equal(t, []string{"a", "b", "c", "d"}, members) }) t.Run("RangeInclusive", func(t *testing.T) { members, err := b.ZRangeByLex("foo", "[b", "[c", 0) assert.NoError(t, err) assert.Equal(t, []string{"b", "c"}, members) }) t.Run("SingleElement", func(t *testing.T) { members, err := b.ZRangeByLex("foo", "[b", "[b", 0) assert.NoError(t, err) assert.Equal(t, []string{"b"}, members) }) t.Run("SingleAbsentElement", func(t *testing.T) { members, err := b.ZRangeByLex("foo", "[z", "[z", 1) assert.NoError(t, err) assert.Empty(t, members) }) t.Run("Rev", func(t *testing.T) { t.Run("Inf", func(t *testing.T) { members, err := b.ZRevRangeByLex("foo", "-", "+", 0) assert.NoError(t, err) assert.Equal(t, []string{"d", "c", "b", "a"}, members) }) t.Run("MinMaxExclusive", func(t *testing.T) { members, err := b.ZRevRangeByLex("foo", "(a", "(d", 0) assert.NoError(t, err) assert.Equal(t, []string{"c", "b"}, members) }) t.Run("MinMaxInclusive", func(t *testing.T) { members, err := b.ZRevRangeByLex("foo", "[a", "[d", 0) assert.NoError(t, err) assert.Equal(t, []string{"d", "c", "b", "a"}, members) }) t.Run("RangeInclusive", func(t *testing.T) { members, err := b.ZRevRangeByLex("foo", "[b", "[c", 0) assert.NoError(t, err) assert.Equal(t, []string{"c", "b"}, members) }) t.Run("SingleAbsentElement", func(t *testing.T) { members, err := b.ZRevRangeByLex("foo", "[z", "[z", 1) assert.NoError(t, err) assert.Empty(t, members) }) }) }) t.Run("ZHRangeByLex", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZHAdd("foo", "w", "alice", 0.0)) assert.NoError(t, b.ZHAdd("foo", "x", "bob", 0.0)) assert.NoError(t, b.ZHAdd("foo", "y", "carol", 0.0)) assert.NoError(t, b.ZHAdd("foo", "z", "dan", 0.0)) t.Run("Inf", func(t *testing.T) { members, err := b.ZHRangeByLex("foo", "-", "+", 0) assert.NoError(t, err) assert.Equal(t, []string{"alice", "bob", "carol", "dan"}, members) }) t.Run("MinGreaterThanMax", func(t *testing.T) { members, err := b.ZHRangeByLex("foo", "(z", "(w", 0) assert.NoError(t, err) assert.Empty(t, members) }) t.Run("MinMaxExclusive", func(t *testing.T) { members, err := b.ZHRangeByLex("foo", "(w", "(z", 0) assert.NoError(t, err) assert.Equal(t, []string{"bob", "carol"}, members) }) t.Run("MinMaxInclusive", func(t *testing.T) { members, err := b.ZHRangeByLex("foo", "[w", "[z", 0) assert.NoError(t, err) assert.Equal(t, []string{"alice", "bob", "carol", "dan"}, members) }) t.Run("RangeInclusive", func(t *testing.T) { members, err := b.ZHRangeByLex("foo", "[x", "[y", 0) assert.NoError(t, err) assert.Equal(t, []string{"bob", "carol"}, members) }) t.Run("SingleElement", func(t *testing.T) { members, err := b.ZHRangeByLex("foo", "[x", "[x", 0) assert.NoError(t, err) assert.Equal(t, []string{"bob"}, members) }) t.Run("SingleAbsentElement", func(t *testing.T) { members, err := b.ZHRangeByLex("foo", "[q", "[q", 1) assert.NoError(t, err) assert.Empty(t, members) }) // to make migrations easier, zhrange functions should also return zadded members since it // doesn't really cost us anything t.Run("ZAddMigration", func(t *testing.T) { assert.NoError(t, b.ZAdd("zaddtest", "a", 0.0)) assert.NoError(t, b.ZHAdd("zaddtest", "b", "bob", 0.0)) assert.NoError(t, b.ZAdd("zaddtest", "c", 0.0)) assert.NoError(t, b.ZHAdd("zaddtest", "d", "dan", 0.0)) members, err := b.ZHRangeByLex("zaddtest", "-", "+", 0) assert.NoError(t, err) assert.Equal(t, []string{"a", "bob", "c", "dan"}, members) }) t.Run("Rev", func(t *testing.T) { t.Run("Inf", func(t *testing.T) { members, err := b.ZHRevRangeByLex("foo", "-", "+", 0) assert.NoError(t, err) assert.Equal(t, []string{"dan", "carol", "bob", "alice"}, members) }) t.Run("MinMaxExclusive", func(t *testing.T) { members, err := b.ZHRevRangeByLex("foo", "(w", "(z", 0) assert.NoError(t, err) assert.Equal(t, []string{"carol", "bob"}, members) }) t.Run("MinMaxInclusive", func(t *testing.T) { members, err := b.ZHRevRangeByLex("foo", "[w", "[z", 0) assert.NoError(t, err) assert.Equal(t, []string{"dan", "carol", "bob", "alice"}, members) }) t.Run("RangeInclusive", func(t *testing.T) { members, err := b.ZHRevRangeByLex("foo", "[x", "[y", 0) assert.NoError(t, err) assert.Equal(t, []string{"carol", "bob"}, members) }) t.Run("SingleAbsentElement", func(t *testing.T) { members, err := b.ZHRevRangeByLex("foo", "[q", "[q", 1) assert.NoError(t, err) assert.Empty(t, members) }) }) }) t.Run("ZScore", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZAdd("foo", "a", 0.0)) assert.NoError(t, b.ZAdd("foo", "b", 1.0)) zeroF := 0.0 oneF := 1.0 for _, tc := range []struct { member string expected *float64 }{ {"a", &zeroF}, {"b", &oneF}, {"c", nil}, } { score, err := b.ZScore("foo", tc.member) assert.NoError(t, err) if tc.expected == nil { assert.Nil(t, score) } else { if assert.NotNil(t, score) { assert.Equal(t, *tc.expected, *score) } } } }) t.Run("ZCount", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZAdd("foo", "a", 0.0)) assert.NoError(t, b.ZAdd("foo", "b", 1.0)) assert.NoError(t, b.ZAdd("foo", "c", 2.0)) assert.NoError(t, b.ZAdd("foo", "d", 3.0)) assert.NoError(t, b.ZAdd("foo", "e", 4.0)) assert.NoError(t, b.ZAdd("foo", "f", 5.0)) for _, tc := range []struct { min, max float64 expected int }{ {1.0, 2.0, 2}, {1.0, 1.5, 1}, {math.Inf(-1), 2, 3}, {math.Inf(-1), math.Inf(1), 6}, {2.0, math.Inf(1), 4}, } { n, err := b.ZCount("foo", tc.min, tc.max) assert.NoError(t, err) assert.Equal(t, tc.expected, n, fmt.Sprintf("%#v %#v", tc.min, tc.max)) } // DynamoDB has to paginate requests for ZCounts on big sets. t.Run("BigZSet", func(t *testing.T) { bigString := strings.Repeat("x", 1000) for i := 0; i < 1100; i++ { require.NoError(t, b.ZAdd("big", strconv.Itoa(i)+bigString, 0.0)) } n, err := b.ZCount("big", 0.0, 0.0) assert.NoError(t, err) assert.Equal(t, 1100, n) }) }) t.Run("ZLexCount", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZAdd("foo", "a", 0.0)) assert.NoError(t, b.ZAdd("foo", "c", 0.0)) assert.NoError(t, b.ZAdd("foo", "e", 0.0)) assert.NoError(t, b.ZAdd("foo", "g", 0.0)) for _, tc := range []struct { min, max string expected int }{ {"[g", "[g", 1}, {"[a", "[g", 4}, {"(a", "[g", 3}, {"[a", "(g", 3}, {"[c", "[e", 2}, {"[e", "(g", 1}, {"(a", "[e", 2}, {"[e", "[e", 1}, {"[f", "[f", 0}, {"[_", "[g", 4}, {"[a", "[h", 4}, {"-", "[e", 3}, {"[c", "+", 3}, {"-", "+", 4}, {"[a", "(e", 2}, {"[a", "(f", 3}, } { n, err := b.ZLexCount("foo", tc.min, tc.max) assert.NoError(t, err) assert.Equal(t, tc.expected, n, fmt.Sprintf("%#v %#v", tc.min, tc.max)) } }) t.Run("ZIncrBy", func(t *testing.T) { b := newBackend() t.Run("ExistingKey", func(t *testing.T) { assert.NoError(t, b.ZAdd("existing", "abc", 0.5)) newVal, err := b.ZIncrBy("existing", "abc", 1) require.NoError(t, err) assert.EqualValues(t, 1.5, newVal) vals, err := b.ZRangeByScore("existing", 1.5, 1.5, 10) require.NoError(t, err) assert.Equal(t, []string{"abc"}, vals) vals, err = b.ZRangeByScore("existing", 0, 1, 10) require.NoError(t, err) assert.Empty(t, vals) }) t.Run("NoExistingKey", func(t *testing.T) { newVal, err := b.ZIncrBy("missing", "bcd", 1) require.NoError(t, err) assert.EqualValues(t, 1, newVal) vals, err := b.ZRangeByScore("missing", 1, 1, 10) require.NoError(t, err) assert.Equal(t, []string{"bcd"}, vals) }) t.Run("Negative", func(t *testing.T) { assert.NoError(t, b.ZAdd("neg", "cde", 0.5)) newVal, err := b.ZIncrBy("neg", "cde", -1) require.NoError(t, err) assert.EqualValues(t, -0.5, newVal) vals, err := b.ZRangeByScore("neg", -0.5, -0.5, 10) require.NoError(t, err) assert.Equal(t, []string{"cde"}, vals) vals, err = b.ZRangeByScore("neg", 0, 1, 10) require.NoError(t, err) assert.Empty(t, vals) }) t.Run("MultipleWriters", func(t *testing.T) { outerLoops := 10 innerLoops := 10 var wg sync.WaitGroup for i := 0; i < outerLoops; i++ { wg.Add(1) go func() { defer wg.Done() successful := 0 errorStreak := 0 for successful < innerLoops { _, err := b.ZIncrBy("MultipleWriters", "foo", 1) if err == nil { successful++ errorStreak = 0 } else { errorStreak++ require.Less(t, errorStreak, 100) } } }() } wg.Wait() vals, err := b.ZRangeByScore("MultipleWriters", float64(outerLoops*innerLoops), float64(outerLoops*innerLoops), 10) require.NoError(t, err) assert.Equal(t, []string{"foo"}, vals) }) }) t.Run("ZRangeByScoreWithScores", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZAdd("foo", "-2", -2.0)) assert.NoError(t, b.ZAdd("foo", "-1", -1.0)) assert.NoError(t, b.ZAdd("foo", "-0.5", -0.5)) assert.NoError(t, b.ZAdd("foo", "0", 0.0)) assert.NoError(t, b.ZAdd("foo", "0.5", 0.5)) assert.NoError(t, b.ZAdd("foo", "0.5b", 0.5)) assert.NoError(t, b.ZAdd("foo", "1", 1.0)) assert.NoError(t, b.ZAdd("foo", "2", 2.0)) t.Run("MinMax", func(t *testing.T) { members, err := b.ZRangeByScoreWithScores("foo", -0.5, 1.0, 0) assert.NoError(t, err) assert.Equal(t, keyvaluestore.ScoredMembers{ {Score: -0.5, Value: "-0.5"}, {Score: 0, Value: "0"}, {Score: 0.5, Value: "0.5"}, {Score: 0.5, Value: "0.5b"}, {Score: 1, Value: "1"}, }, members) }) t.Run("-Inf", func(t *testing.T) { members, err := b.ZRangeByScoreWithScores("foo", math.Inf(-1), 1, 0) assert.NoError(t, err) assert.Equal(t, keyvaluestore.ScoredMembers{ {Score: -2, Value: "-2"}, {Score: -1, Value: "-1"}, {Score: -0.5, Value: "-0.5"}, {Score: 0, Value: "0"}, {Score: 0.5, Value: "0.5"}, {Score: 0.5, Value: "0.5b"}, {Score: 1, Value: "1"}, }, members) }) t.Run("+Inf", func(t *testing.T) { members, err := b.ZRangeByScoreWithScores("foo", -0.5, math.Inf(1), 0) assert.NoError(t, err) assert.Equal(t, keyvaluestore.ScoredMembers{ {Score: -0.5, Value: "-0.5"}, {Score: 0, Value: "0"}, {Score: 0.5, Value: "0.5"}, {Score: 0.5, Value: "0.5b"}, {Score: 1, Value: "1"}, {Score: 2, Value: "2"}, }, members) }) }) t.Run("ZRevRangeByScoreWithScores", func(t *testing.T) { b := newBackend() assert.NoError(t, b.ZAdd("foo", "-2", -2.0)) assert.NoError(t, b.ZAdd("foo", "-1", -1.0)) assert.NoError(t, b.ZAdd("foo", "-0.5", -0.5)) assert.NoError(t, b.ZAdd("foo", "0", 0.0)) assert.NoError(t, b.ZAdd("foo", "0.5", 0.5)) assert.NoError(t, b.ZAdd("foo", "0.5b", 0.5)) assert.NoError(t, b.ZAdd("foo", "1", 1.0)) assert.NoError(t, b.ZAdd("foo", "2", 2.0)) t.Run("MinMax", func(t *testing.T) { members, err := b.ZRevRangeByScoreWithScores("foo", -0.5, 1.0, 0) assert.NoError(t, err) assert.Equal(t, keyvaluestore.ScoredMembers{ {Score: 1, Value: "1"}, {Score: 0.5, Value: "0.5b"}, {Score: 0.5, Value: "0.5"}, {Score: 0, Value: "0"}, {Score: -0.5, Value: "-0.5"}, }, members) }) t.Run("-Inf", func(t *testing.T) { members, err := b.ZRevRangeByScoreWithScores("foo", math.Inf(-1), 1, 0) assert.NoError(t, err) assert.Equal(t, keyvaluestore.ScoredMembers{ {Score: 1, Value: "1"}, {Score: 0.5, Value: "0.5b"}, {Score: 0.5, Value: "0.5"}, {Score: 0, Value: "0"}, {Score: -0.5, Value: "-0.5"}, {Score: -1, Value: "-1"}, {Score: -2, Value: "-2"}, }, members) }) t.Run("+Inf", func(t *testing.T) { members, err := b.ZRevRangeByScoreWithScores("foo", -0.5, math.Inf(1), 0) assert.NoError(t, err) assert.Equal(t, keyvaluestore.ScoredMembers{ {Score: 2, Value: "2"}, {Score: 1, Value: "1"}, {Score: 0.5, Value: "0.5b"}, {Score: 0.5, Value: "0.5"}, {Score: 0, Value: "0"}, {Score: -0.5, Value: "-0.5"}, }, members) }) }) }
keyvaluestoretest/backend.go
0.524882
0.635449
backend.go
starcoder
package slice // DeduplicateBool performs order preserving, in place deduplication of a bool slice func DeduplicateBool(a []bool) []bool { if len(a) < 2 { return a } seen := make(map[bool]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateByte performs order preserving, in place deduplication of a byte slice func DeduplicateByte(a []byte) []byte { if len(a) < 2 { return a } seen := make(map[byte]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateComplex128 performs order preserving, in place deduplication of a complex128 slice func DeduplicateComplex128(a []complex128) []complex128 { if len(a) < 2 { return a } seen := make(map[complex128]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateComplex64 performs order preserving, in place deduplication of a complex64 slice func DeduplicateComplex64(a []complex64) []complex64 { if len(a) < 2 { return a } seen := make(map[complex64]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateFloat32 performs order preserving, in place deduplication of a float32 slice func DeduplicateFloat32(a []float32) []float32 { if len(a) < 2 { return a } seen := make(map[float32]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateFloat64 performs order preserving, in place deduplication of a float64 slice func DeduplicateFloat64(a []float64) []float64 { if len(a) < 2 { return a } seen := make(map[float64]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateInt performs order preserving, in place deduplication of a int slice func DeduplicateInt(a []int) []int { if len(a) < 2 { return a } seen := make(map[int]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateInt16 performs order preserving, in place deduplication of a int16 slice func DeduplicateInt16(a []int16) []int16 { if len(a) < 2 { return a } seen := make(map[int16]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateInt32 performs order preserving, in place deduplication of a int32 slice func DeduplicateInt32(a []int32) []int32 { if len(a) < 2 { return a } seen := make(map[int32]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateInt64 performs order preserving, in place deduplication of a int64 slice func DeduplicateInt64(a []int64) []int64 { if len(a) < 2 { return a } seen := make(map[int64]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateInt8 performs order preserving, in place deduplication of a int8 slice func DeduplicateInt8(a []int8) []int8 { if len(a) < 2 { return a } seen := make(map[int8]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateRune performs order preserving, in place deduplication of a rune slice func DeduplicateRune(a []rune) []rune { if len(a) < 2 { return a } seen := make(map[rune]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateString performs order preserving, in place deduplication of a string slice func DeduplicateString(a []string) []string { if len(a) < 2 { return a } seen := make(map[string]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateUint performs order preserving, in place deduplication of a uint slice func DeduplicateUint(a []uint) []uint { if len(a) < 2 { return a } seen := make(map[uint]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateUint16 performs order preserving, in place deduplication of a uint16 slice func DeduplicateUint16(a []uint16) []uint16 { if len(a) < 2 { return a } seen := make(map[uint16]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateUint32 performs order preserving, in place deduplication of a uint32 slice func DeduplicateUint32(a []uint32) []uint32 { if len(a) < 2 { return a } seen := make(map[uint32]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateUint64 performs order preserving, in place deduplication of a uint64 slice func DeduplicateUint64(a []uint64) []uint64 { if len(a) < 2 { return a } seen := make(map[uint64]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateUint8 performs order preserving, in place deduplication of a uint8 slice func DeduplicateUint8(a []uint8) []uint8 { if len(a) < 2 { return a } seen := make(map[uint8]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] } // DeduplicateUintptr performs order preserving, in place deduplication of a uintptr slice func DeduplicateUintptr(a []uintptr) []uintptr { if len(a) < 2 { return a } seen := make(map[uintptr]struct{}) j := 0 for k := range a { if _, ok := seen[a[k]]; ok { continue } seen[a[k]] = struct{}{} a[j] = a[k] j++ } return a[:j] }
deduplicate.go
0.80479
0.609059
deduplicate.go
starcoder
package stats import ( "fmt" "math" "sort" ) // Sum returns the sum of values in a sample. func Sum(a []float64) float64 { sum := 0.0 for _, v := range a { sum += v } return sum } // Mean returns the mean value of the sample. func Mean(a []float64) float64 { return Sum(a) / float64(len(a)) } // Cov returns the covariance of the 2 samples. Panics if lengths don't match. func Cov(a, b []float64) float64 { assertMatchingLengths(a, b) ma := Mean(a) mb := Mean(b) cov := 0.0 for i := range a { cov += (a[i] - ma) * (b[i] - mb) } cov /= float64(len(a)) return cov } // Var returns the variance of the sample. func Var(a []float64) float64 { return Cov(a, a) } // Std returns the standard deviation of the sample. func Std(a []float64) float64 { return math.Sqrt(Var(a)) } // Corr returns the correlation between the samples. Panics if lengths don't // match. func Corr(a, b []float64) float64 { return Cov(a, b) / Std(a) / Std(b) } // Min returns the minimal element in the sample. func Min(a []float64) float64 { if len(a) == 0 { return math.NaN() } min := a[0] for _, v := range a { if v < min { min = v } } return min } // Max returns the maximal element in the sample. func Max(a []float64) float64 { if len(a) == 0 { return math.NaN() } max := a[0] for _, v := range a { if v > max { max = v } } return max } // Span returns the span of the sample (max - min). func Span(a []float64) float64 { return Max(a) - Min(a) } // Ent returns the entropy for the given distribution. // The distribution does not have to sum up to 1. func Ent(distribution []float64) float64 { // Sum of the distribution. sum := Sum(distribution) // Go over each bucket. result := 0.0 for _, v := range distribution { // Negative values are not allowed. if v < 0.0 { return math.NaN() } // Ignore zeros. if v == 0.0 { continue } // Probability. p := v / sum // Entropy. result -= p * math.Log2(p) } return result } // Hist creates a histogram of counts of values in the given slice. 'counts' // maps a unique value from 'a' to its count. 'byValue' holds uniqe values // sorted. 'byCount' holds unique values sorted by their counts, most common // first. func Hist(a []float64) (counts map[float64]int, byValue []float64, byCount []float64) { // Create raw counts. counts = map[float64]int{} for _, value := range a { counts[value]++ } // Take unique values. byValue = make([]float64, 0, len(counts)) for value := range counts { byValue = append(byValue, value) } sort.Sort(sort.Float64Slice(byValue)) // Sort by counts. byCount = make([]float64, len(byValue)) copy(byCount, byValue) sort.Sort(&histSorter{counts, byCount}) return } // Type for histogram sorting. type histSorter struct { counts map[float64]int values []float64 } func (h *histSorter) Len() int { return len(h.values) } func (h *histSorter) Less(i, j int) bool { return h.counts[h.values[i]] > h.counts[h.values[j]] } func (h *histSorter) Swap(i, j int) { h.values[i], h.values[j] = h.values[j], h.values[i] } // Panics if 2 vectors are of inequal lengths. func assertMatchingLengths(a, b []float64) { if len(a) != len(b) { panic(fmt.Sprintf("Mismatching lengths: %d, %d.", len(a), len(b))) } }
stats/stats.go
0.888885
0.65435
stats.go
starcoder
package eval import ( "fmt" ) // ScoreType represents the type of score. type ScoreType int8 const ( Invalid ScoreType = iota Heuristic MateInX Inf // Won position (= opponent checkmate) NegInf // Lost position (= in checkmate) ) // Pawns presents a fractional number of pawns. type Pawns float32 func (p Pawns) String() string { return fmt.Sprintf("%.2f", p) } // Limit crops the value to +/- limit. func Limit(pawns, limit Pawns) Pawns { switch { case pawns < -limit: return -limit case limit < pawns: return limit default: return pawns } } // Score is signed position score in "pawns", unless decided or mate-in-X. Positive favors // the side to move. If all pawns become queens and the opponent has only the king left, // the standard material advantage score is: 9*8 (p) + 9 (q) + 2*5 (r) + 2*3 (k) + 2*3 (b) // = 103. The score can be arbitrary, but is reported as centi-pawns to humans. 64bits. type Score struct { Type ScoreType Mate int8 // Non-zero ply to forced mate. Negative if being mated. Pawns Pawns } var ( InvalidScore = Score{Type: Invalid} ZeroScore = Score{Type: Heuristic} InfScore = Score{Type: Inf} NegInfScore = Score{Type: NegInf} ) // HeuristicScore returns a Heuristic score with the given evaluation. func HeuristicScore(pawns Pawns) Score { return Score{Type: Heuristic, Pawns: pawns} } // MateInXScore returns a MateInX score with the given evaluation. func MateInXScore(mate int8) Score { return Score{Type: MateInX, Mate: mate} } func (s Score) IsInvalid() bool { return s.Type == Invalid } func (s Score) IsHeuristic() bool { return s.Type == Heuristic } func (s Score) IsMateInX() bool { return s.Type == MateInX } func (s Score) IsInf() bool { return s.Type == Inf } func (s Score) IsNegInf() bool { return s.Type == NegInf } // MateDistance returns the ply distance to CheckMate, if known. If a forced mate is possible, // there is generally no reason to search deeper. func (s Score) MateDistance() (int8, bool) { switch s.Type { case MateInX: if s.Mate < 0 { return -s.Mate, true } return s.Mate, true case Inf, NegInf: return 0, true default: return 0, false } } // Negates returns the negative score, as viewed from the opponent. func (s Score) Negate() Score { switch s.Type { case Heuristic: return HeuristicScore(-s.Pawns) case MateInX: return MateInXScore(-s.Mate) case Inf: return NegInfScore case NegInf: return InfScore default: return InvalidScore } } // Less implements < Score ordering. The group ordering is: -inf < negative mate < // heuristic < positive mate < inf. Mates are ordered by closeness to checkmate // within each mate group, e.g., M2 < M1 and M-1 < M-2. func (s Score) Less(o Score) bool { if s == o || s.Type == Inf || o.Type == NegInf { return false } if s.Type == NegInf || o.Type == Inf { return true } switch s.Type { case Heuristic: switch o.Type { case Heuristic: return s.Pawns < o.Pawns case MateInX: return o.Mate > 0 } case MateInX: switch o.Type { case Heuristic: return s.Mate < 0 case MateInX: if s.Mate < 0 || o.Mate < 0 { return s.Mate < o.Mate } return s.Mate > o.Mate } } return false } func (s Score) String() string { switch s.Type { case Heuristic: return s.Pawns.String() case MateInX: return fmt.Sprintf("M%v", s.Mate) case Inf: return "+inf" case NegInf: return "-inf" default: return "?" } } // IncrementMateDistance adds 1 ply to a MateInX or Inf/NegInf. Heuristic scores are unchanged. func IncrementMateDistance(s Score) Score { switch s.Type { case Inf: return MateInXScore(1) case NegInf: return MateInXScore(-1) case MateInX: if s.Mate < 0 { return MateInXScore(s.Mate - 1) } return MateInXScore(s.Mate + 1) default: return s } } // Max returns the largest of the given scores. func Max(a, b Score) Score { if a.Less(b) { return b } return a } // Min returns the smallest of the given scores. func Min(a, b Score) Score { if a.Less(b) { return a } return b }
pkg/eval/score.go
0.806738
0.686777
score.go
starcoder
package main import ( "encoding/json" "errors" "fmt" "io/ioutil" ) // machineConfig contains the configuration information of a single machine. // This can be used to construct a machine object. type machineConfig struct { Name string `json:"name"` Nodes [][]string `json:"nodes"` ConsoleIn struct { Side string `json:"side"` Pos int `json:"Pos"` } `json:"consoleIn"` ConsoleOut struct { Side string `json:"side"` Pos int `json:"pos"` } `json:"consoleOut"` } // newMachineConfig creates a new machine configuration object based on the // provided config file location. func newMachineConfig(config string) (machineConfig, error) { var mc machineConfig // Read the data from the config file data, err := ioutil.ReadFile(config) if err != nil { return machineConfig{}, err } // Interpret the data as JSON and populate the machine configuration object err = json.Unmarshal(data, &mc) if err != nil { return machineConfig{}, err } // Make sure the given nodes create a rectangle nodeWidth := len(mc.Nodes[0]) nodeHeight := len(mc.Nodes) for _, val := range mc.Nodes { if len(val) != nodeWidth { return machineConfig{}, errors.New("node array must form a rectangle") } } // Check console in position for validity switch mc.ConsoleIn.Side { case "top": fallthrough case "bottom": if mc.ConsoleIn.Pos < 0 || mc.ConsoleIn.Pos >= nodeWidth { return machineConfig{}, errors.New("consoleIn pos must be within the width of the node array") } case "right": fallthrough case "left": if mc.ConsoleIn.Pos < 0 || mc.ConsoleIn.Pos >= nodeHeight { return machineConfig{}, errors.New("consoleIn pos must be within the height of the node array") } default: return machineConfig{}, errors.New("consoleIn has an invalid side value") } // Check console out position for validity switch mc.ConsoleOut.Side { case "top": fallthrough case "bottom": if mc.ConsoleOut.Pos < 0 || mc.ConsoleOut.Pos >= nodeWidth { return machineConfig{}, errors.New("consoleOut pos must be within the width of the node array") } case "right": fallthrough case "left": if mc.ConsoleOut.Pos < 0 || mc.ConsoleOut.Pos >= nodeHeight { return machineConfig{}, errors.New("consoleOut pos must be within the height of the node array") } default: return machineConfig{}, errors.New("consoleOut has an invalid side value") } return mc, nil } // machine represents the TIS-100 instance. It is a collection of nodes. type machine struct { nodes [][]node stopSignal chan struct{} consoleIn port consoleOut port } // newMachine creates a new machine from the given machine config . It // creates empty nodes based on the configuration and wires them up to each // other. func newMachine(config machineConfig) (machine, error) { var m machine m.stopSignal = make(chan struct{}) // Construct the console input and output m.consoleIn = newConsoleIn() m.consoleOut = newConsoleOut() // Construct an empty array of nodes based on the size of the nodes in the config m.nodes = make([][]node, len(config.Nodes)) for i := range m.nodes { m.nodes[i] = make([]node, len(config.Nodes[0])) } nodeWidth := len(m.nodes[0]) nodeHeight := len(m.nodes) for y, valY := range config.Nodes { for x, valX := range valY { // The node's ports default to ones that go nowhere var up, down, left, right port = newNodePort(), newNodePort(), newNodePort(), newNodePort() // See if this is the node that console in should be wired to switch config.ConsoleIn.Side { case "top": if y == 0 && x == config.ConsoleIn.Pos { up = m.consoleIn } case "bottom": if y == nodeHeight-1 && x == config.ConsoleIn.Pos { down = m.consoleIn } case "left": if x == 0 && y == config.ConsoleIn.Pos { left = m.consoleIn } case "right": if x == nodeWidth-1 && y == config.ConsoleIn.Pos { right = m.consoleIn } } // See if this is the node that console out should be wired to switch config.ConsoleOut.Side { case "top": if y == 0 && x == config.ConsoleOut.Pos { up = m.consoleOut } case "bottom": if y == nodeHeight-1 && x == config.ConsoleOut.Pos { down = m.consoleOut } case "left": if x == 0 && y == config.ConsoleOut.Pos { left = m.consoleOut } case "right": if x == nodeWidth-1 && y == config.ConsoleOut.Pos { right = m.consoleOut } } switch valX { case "e": // The node is an execution node any := newAnyPort(up, down, left, right) if y-1 >= 0 { // If there is a node above this node, connect it up = m.nodes[y-1][x].getDown() } if x-1 >= 0 { // If there is a node to the left of this node, connect it left = m.nodes[y][x-1].getRight() } m.nodes[y][x] = newExecutionNode(fmt.Sprint(x, "-", y), up, down, left, right, any.lastUsedPort, any) case "s": // The node is a stack node if y-1 >= 0 { // If there is a node above this node. connect it up = m.nodes[y-1][x].getDown() } if x-1 >= 0 { // If there is a node to the left of this node, connect it left = m.nodes[y][x-1].getRight() } m.nodes[y][x] = newStackNode(up, down, left, right) default: // The node is invalid return machine{}, errors.New("invalid node type '" + valX + "'") } } } return m, nil } // start starts all execution nodes. func (m *machine) start() { for _, row := range m.nodes { for _, elem := range row { go elem.start(m.stopSignal) } } }
machine.go
0.578329
0.460653
machine.go
starcoder
package collections // Element represents (key, value) with backed by the Data interface type Element struct { Key Data Value Data } // ElementsByKeyStringAsc used to used low to high where key is of type string type ElementsByKeyStringAsc []Element func (e ElementsByKeyStringAsc) Len() int { return len(e) } func (e ElementsByKeyStringAsc) Less(i, j int) bool { return e[i].Key.String() < e[j].Key.String() } func (e ElementsByKeyStringAsc) Swap(i, j int) { e[i], e[j] = e[j], e[i] } // ElementsByKeyStringDesc used to used high to low where key is of type string type ElementsByKeyStringDesc []Element func (e ElementsByKeyStringDesc) Len() int { return len(e) } func (e ElementsByKeyStringDesc) Less(i, j int) bool { return e[i].Key.String() > e[j].Key.String() } func (e ElementsByKeyStringDesc) Swap(i, j int) { e[i], e[j] = e[j], e[i] } // ElementsByKeyIntAsc used to used low to high where key is of type string type ElementsByKeyIntAsc []Element func (e ElementsByKeyIntAsc) Len() int { return len(e) } func (e ElementsByKeyIntAsc) Less(i, j int) bool { return e[i].Key.Int() < e[j].Key.Int() } func (e ElementsByKeyIntAsc) Swap(i, j int) { e[i], e[j] = e[j], e[i] } // ElementsByKeyIntDesc used to used high to low where key is of type string type ElementsByKeyIntDesc []Element func (e ElementsByKeyIntDesc) Len() int { return len(e) } func (e ElementsByKeyIntDesc) Less(i, j int) bool { return e[i].Key.Int() > e[j].Key.Int() } func (e ElementsByKeyIntDesc) Swap(i, j int) { e[i], e[j] = e[j], e[i] } // ElementsByValueStringAsc used to used low to high where value is of type string type ElementsByValueStringAsc []Element func (e ElementsByValueStringAsc) Len() int { return len(e) } func (e ElementsByValueStringAsc) Less(i, j int) bool { return e[i].Value.String() < e[j].Value.String() } func (e ElementsByValueStringAsc) Swap(i, j int) { e[i], e[j] = e[j], e[i] } // ElementsByValueStringDesc used to used high to low where value is of type string type ElementsByValueStringDesc []Element func (e ElementsByValueStringDesc) Len() int { return len(e) } func (e ElementsByValueStringDesc) Less(i, j int) bool { return e[i].Value.String() > e[j].Value.String() } func (e ElementsByValueStringDesc) Swap(i, j int) { e[i], e[j] = e[j], e[i] } // ElementsByValueIntAsc used to used low to high where value is of type string type ElementsByValueIntAsc []Element func (e ElementsByValueIntAsc) Len() int { return len(e) } func (e ElementsByValueIntAsc) Less(i, j int) bool { return e[i].Value.Int() < e[j].Value.Int() } func (e ElementsByValueIntAsc) Swap(i, j int) { e[i], e[j] = e[j], e[i] } // ElementsByValueIntDesc used to used high to low where value is of type string type ElementsByValueIntDesc []Element func (e ElementsByValueIntDesc) Len() int { return len(e) } func (e ElementsByValueIntDesc) Less(i, j int) bool { return e[i].Value.Int() > e[j].Value.Int() } func (e ElementsByValueIntDesc) Swap(i, j int) { e[i], e[j] = e[j], e[i] }
element_sorters.go
0.717408
0.442275
element_sorters.go
starcoder
package sparsemat import ( "encoding/json" "fmt" "reflect" "sort" "strings" "github.com/olekukonko/tablewriter" ) type DOKVector struct { length int values map[int]int } type dokVector struct { Length int Values map[int]int } func (vec *DOKVector) MarshalJSON() ([]byte, error) { return json.Marshal(dokVector{ Length: vec.length, Values: vec.values, }) } func (vec *DOKVector) UnmarshalJSON(bytes []byte) error { var v dokVector err := json.Unmarshal(bytes, &v) if err != nil { return err } vec.length = v.Length vec.values = v.Values return nil } func DOKVec(length int, values ...int) SparseVector { if len(values) != 0 { if length != len(values) { panic("length and number of values must be equal") } } return dokVec(length, values...) } func dokVec(length int, values ...int) *DOKVector { valuesMap := make(map[int]int) for i := 0; i < len(values); i++ { if values[i] == 1 { valuesMap[i] = 1 } } vec := DOKVector{ length: length, values: valuesMap, } return &vec } func DOKVecCopy(a SparseVector) SparseVector { v := dokVec(a.Len()) for i := range a.NonzeroMap() { v.values[i] = 1 } return v } //String returns a string representation of this vector. func (vec *DOKVector) String() string { buff := &strings.Builder{} table := tablewriter.NewWriter(buff) table.SetBorder(false) table.SetColumnSeparator("") table.SetRowSeparator("") table.SetHeaderLine(false) row := make([]string, vec.Len()) for i := 0; i < vec.Len(); i++ { row[i] = fmt.Sprint(vec.at(i)) } table.Append(row) table.Render() return buff.String() } func (vec *DOKVector) checkBounds(i int) { if i < 0 || i >= vec.Len() { panic(fmt.Sprintf("%v out of range: [0-%v]", i, vec.Len()-1)) } } //At returns the value at index i. func (vec *DOKVector) At(i int) int { vec.checkBounds(i) return vec.at(i) } func (vec *DOKVector) at(j int) int { if _, has := vec.values[j]; has { return 1 } return 0 } //Set sets the value at row index i and column index j to value. func (vec *DOKVector) Set(i, value int) SparseVector { vec.checkBounds(i) vec.set(i, value%2) return vec } func (vec *DOKVector) set(j, value int) { if value == 0 { _, has := vec.values[j] if has { delete(vec.values, j) } return } vec.values[j] = 1 } //SetVec replaces the values of this vector with the values of from vector a. func (vec *DOKVector) SetVec(a SparseVector, i int) SparseVector { vec.checkBounds(i + a.Len() - 1) for j := 0; j < a.Len(); j++ { vec.set(j+i, a.At(j)) } return vec } func (vec *DOKVector) Len() int { return vec.length } func (vec *DOKVector) Dot(a SparseVector) int { if vec.length != a.Len() { panic("lengths must be equal") } v := 0 for i := range vec.values { v += a.At(i) } return v % 2 } func (vec *DOKVector) NonzeroMap() (indexToValues map[int]int) { indexToValues = make(map[int]int) for i := range vec.values { indexToValues[i] = 1 } return indexToValues } func (vec *DOKVector) NonzeroArray() (indices []int) { indices = make([]int, 0, len(vec.values)) for i := range vec.values { indices = append(indices, i) } sort.Ints(indices) return } //Slice creates a slice of the Vector. The slice will be connected to the original Vector, changes to one // causes changes in the other. func (vec *DOKVector) Slice(i, length int) SparseVector { if length <= 0 { panic("slice len must >0") } vec.checkBounds(i) vec.checkBounds(i + length - 1) tmp := make(map[int]int) if length < len(vec.values) { for j := 0; j < length; j++ { if vec.values[j+i] > 0 { tmp[j] = 1 } } } else { for j := range vec.values { if i <= j && j < i+length { tmp[j-i] = 1 } } } return &DOKVector{ length: length, values: tmp, } } func (vec *DOKVector) Add(a, b SparseVector) SparseVector { if a == nil || b == nil { panic("addition input was found to be nil") } if a.Len() != b.Len() { panic("adding vectors must have the same length") } if vec.Len() != a.Len() { panic("adding vectors, destination must have the same length") } for i := 0; i < a.Len(); i++ { vec.set(i, (a.At(i)+b.At(i))%2) } return vec } func (vec *DOKVector) Equals(v SparseVector) bool { return vec.length == v.Len() && reflect.DeepEqual(vec.values, v.NonzeroMap()) } func (vec *DOKVector) MulMat(vec2 SparseVector, mat SparseMat) SparseVector { if vec == nil || mat == nil { panic("vector multiply input was found to be nil") } matRows, matCols := mat.Dims() if vec2.Len() != matRows { panic(fmt.Sprintf("multiply shape misalignment can't vector-matrix multiply dims: (%v)x(%v,%v)", vec2.Len(), matRows, matCols)) } if vec.length != matCols { panic(fmt.Sprintf("vector not long enough to hold result, actual length:%v required:%v", vec.length, matCols)) } for i := 0; i < matCols; i++ { vec.set(i, vec2.Dot(mat.Column(i))) } return vec } func (vec *DOKVector) MatMul(mat SparseMat, vec2 SparseVector) SparseVector { if vec == nil || vec2 == nil || mat == nil { panic("vector multiply input was found to be nil") } matRows, matCols := mat.Dims() if vec2.Len() != matCols { panic(fmt.Sprintf("multiply shape misalignment can't vector-matrix multiply dims: (%v,%v)x(%v)", matRows, matCols, vec2.Len())) } if vec.length != matRows { panic(fmt.Sprintf("vector not long enough to hold result, actual length:%v required:%v", vec.Len(), matRows)) } for r := 0; r < matRows; r++ { vec.set(r, vec2.Dot(mat.Row(r))) } return vec } func (vec *DOKVector) And(a, b SparseVector) SparseVector { if a == nil || b == nil { panic("AND input was found to be nil") } if a.Len() != b.Len() { panic(fmt.Sprintf("AND shape misalignment both inputs must be equal length found %v and %v", a.Len(), b.Len())) } if vec.Len() != a.Len() { panic(fmt.Sprintf("vec len:%v does not match expected %v", vec.Len(), a.Len())) } for i := 0; i < vec.length; i++ { vec.set(i, a.At(i)&b.At(i)) } return vec } func (vec *DOKVector) Or(a, b SparseVector) SparseVector { if a == nil || b == nil { panic("OR input was found to be nil") } if a.Len() != b.Len() { panic(fmt.Sprintf("OR shape misalignment both inputs must be equal length found %v and %v", a.Len(), b.Len())) } if vec.Len() != a.Len() { panic(fmt.Sprintf("vec len:%v does not match expected %v", vec.Len(), a.Len())) } for i := 0; i < vec.length; i++ { vec.set(i, a.At(i)|b.At(i)) } return vec } func (vec *DOKVector) XOr(a, b SparseVector) SparseVector { if a == nil || b == nil { panic("XOR input was found to be nil") } if a.Len() != b.Len() { panic(fmt.Sprintf("XOR shape misalignment both inputs must be equal length found %v and %v", a.Len(), b.Len())) } if vec.Len() != a.Len() { panic(fmt.Sprintf("vec len:%v does not match expected %v", vec.Len(), a.Len())) } for i := 0; i < vec.length; i++ { vec.set(i, a.At(i)^b.At(i)) } return vec } func (vec *DOKVector) Negate() SparseVector { for i := 0; i < vec.length; i++ { _, has := vec.values[i] if has { delete(vec.values, i) } else { vec.values[i] = 1 } } return vec } func (vec *DOKVector) IsZero() bool { return len(vec.values) == 0 } func (vec *DOKVector) HammingWeight() int { return len(vec.values) } func (vec *DOKVector) HammingDistance(a SparseVector) int { if vec.length != a.Len() { panic("HammingDistance() vectors must be same length") } count := 0 for i := 0; i < vec.length; i++ { if vec.at(i) != a.At(i) { count++ } } return count } //NextSet returns the next bit which is set starting from startingIndex, so if // the startingIndex is set it will be returned, if not it will be the next bit. // If no bits are found has bool will be set to false. func (vec *DOKVector) NextSet(startingIndex int) (index int, has bool) { vec.checkBounds(startingIndex) for i := startingIndex; i < vec.length; i++ { if vec.at(i) > 0 { return i, true } } return -1, false }
dokvec.go
0.715921
0.562357
dokvec.go
starcoder
package chit import "context" // FirstN produces an iterator containing the first n elements of the input // (or all of the input, if there are fewer than n elements). // Excess elements in the input are discarded by calling inp.Cancel. func FirstN[T any](ctx context.Context, inp *Iter[T], n int) *Iter[T] { return New(ctx, func(send func(T) error) error { defer inp.Cancel() for i := 0; i < n; i++ { x, ok, err := inp.Next() if err != nil { return err } if !ok { return nil } err = send(x) if err != nil { return err } } return nil }) } // SkipN produces an iterator containing all but the first n elements of the input. // If the input contains n or fewer elements, // the output iterator will be empty. func SkipN[T any](ctx context.Context, inp *Iter[T], n int) *Iter[T] { return New(ctx, func(send func(T) error) error { for i := 0; i < n; i++ { _, ok, err := inp.Next() if err != nil { return err } if !ok { return nil } } for { x, ok, err := inp.Next() if err != nil { return err } if !ok { return nil } err = send(x) if err != nil { return err } } }) } // LastN produces an iterator containing the last n elements of the input // (or all of the input, if there are fewer than n elements). // This requires buffering up to n elements. // There is no guarantee that any elements will ever be produced: // the input iterator may be infinite! func LastN[T any](ctx context.Context, inp *Iter[T], n int) *Iter[T] { return New(ctx, func(send func(T) error) error { var ( // Circular buffer. buf = make([]T, 0, n) start = 0 ) for { x, ok, err := inp.Next() if err != nil { return err } if !ok { for i := start; i < len(buf); i++ { err = send(buf[i]) if err != nil { return err } } for i := 0; i < start; i++ { err = send(buf[i]) if err != nil { return err } } return nil } if len(buf) < n { buf = append(buf, x) continue } buf[start] = x start = (start + 1) % n } }) }
n.go
0.581778
0.412885
n.go
starcoder
package differs import ( "context" "time" "github.com/dolthub/dolt/go/libraries/doltcore/table/typed/noms" "github.com/dolthub/dolt/go/store/diff" "github.com/dolthub/dolt/go/store/types" ) var _ Differ = (*MapRowsAsDiffs)(nil) // MapRowsAsDiffs takes a map of rows and provides a Differ interface to it's data. Where each row returned is either // returned as an added row, or a deleted row type MapRowsAsDiffs struct { ctx context.Context changeType types.DiffChangeType rd *noms.NomsRangeReader } // NewMapRowsAsDiffs returns a MapRowsAsDiffs object func NewMapRowsAsDiffs(ctx context.Context, nbf *types.NomsBinFormat, changeType types.DiffChangeType, m types.Map, startInclusive, endExclusive types.Value) *MapRowsAsDiffs { var readRange *noms.ReadRange if !types.IsNull(startInclusive) && !types.IsNull(endExclusive) { readRange = noms.NewRangeStartingAt(startInclusive.(types.Tuple), inRangeCheckLess{endExclusive, nbf}) } else if !types.IsNull(startInclusive) { readRange = noms.NewRangeStartingAt(startInclusive.(types.Tuple), noms.InRangeCheckAlways{}) } else if !types.IsNull(endExclusive) { readRange = noms.NewRangeEndingBefore(endExclusive.(types.Tuple), noms.InRangeCheckAlways{}) } else { // range of all values. readRange = &noms.ReadRange{ Start: types.EmptyTuple(nbf), Inclusive: true, Reverse: false, Check: noms.InRangeCheckAlways{}, } } rd := noms.NewNomsRangeReader(nil, m, []*noms.ReadRange{readRange}) return &MapRowsAsDiffs{ ctx: ctx, changeType: changeType, rd: rd, } } // Close cleans up any resources func (m *MapRowsAsDiffs) Close() error { return m.rd.Close(m.ctx) } // GetDiffs gets up to the specified number of diffs. A timeout can be specified and if the requested number of diffs // are not available it will return what is available. A timeout of 0 returns what is immediately available without waiting. // a timeout of -1 will wait indefinitely until the number of diffs are available, or it can return all remaining diffs func (m *MapRowsAsDiffs) GetDiffs(numDiffs int, timeout time.Duration) ([]*diff.Difference, bool, error) { diffs := make([]*diff.Difference, 0, numDiffs) for i := 0; i < numDiffs; i++ { k, v, err := m.rd.ReadKV(m.ctx) if err != nil { return nil, false, err } if m.changeType == types.DiffChangeAdded { diffs = append(diffs, &diff.Difference{ ChangeType: m.changeType, NewValue: v, KeyValue: k, }) } else { diffs = append(diffs, &diff.Difference{ ChangeType: m.changeType, OldValue: v, KeyValue: k, }) } } return diffs, len(diffs) > 0, nil } // inRangeCheckLess check that a given tuple is in range by comparing it to the enclosed value. type inRangeCheckLess struct { val types.Value nbf *types.NomsBinFormat } var _ noms.InRangeCheck = inRangeCheckLess{} // Check implements the interface noms.InRangeCheck. func (i inRangeCheckLess) Check(ctx context.Context, tuple types.Tuple) (valid bool, skip bool, err error) { ok, err := tuple.Less(i.nbf, i.val) return ok, false, err }
go/payments/pkg/doltutils/differs/row_iter_as_differ.go
0.637031
0.415551
row_iter_as_differ.go
starcoder
package constants // AzureDescriptions enumerates Microsoft Azure instance offerings var AzureDescriptions = []Description{ {Size: "Basic_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "centralus", Price: 0.018000}, {Size: "Basic_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "eastus", Price: 0.018000}, {Size: "Basic_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "eastus2", Price: 0.018000}, {Size: "Basic_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "northcentralus", Price: 0.018000}, {Size: "Basic_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "southcentralus", Price: 0.018000}, {Size: "Basic_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "westcentralus", Price: 0.018000}, {Size: "Basic_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "westus", Price: 0.018000}, {Size: "Basic_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "westus2", Price: 0.018000}, {Size: "Basic_A1", CPU: 1, RAM: 1.750000, Disk: "40", Region: "centralus", Price: 0.047000}, {Size: "Basic_A1", CPU: 1, RAM: 1.750000, Disk: "40", Region: "eastus", Price: 0.044000}, {Size: "Basic_A1", CPU: 1, RAM: 1.750000, Disk: "40", Region: "eastus2", Price: 0.044000}, {Size: "Basic_A1", CPU: 1, RAM: 1.750000, Disk: "40", Region: "northcentralus", Price: 0.047000}, {Size: "Basic_A1", CPU: 1, RAM: 1.750000, Disk: "40", Region: "southcentralus", Price: 0.044000}, {Size: "Basic_A1", CPU: 1, RAM: 1.750000, Disk: "40", Region: "westcentralus", Price: 0.044000}, {Size: "Basic_A1", CPU: 1, RAM: 1.750000, Disk: "40", Region: "westus", Price: 0.047000}, {Size: "Basic_A1", CPU: 1, RAM: 1.750000, Disk: "40", Region: "westus2", Price: 0.044000}, {Size: "Basic_A2", CPU: 2, RAM: 3.500000, Disk: "60", Region: "centralus", Price: 0.094000}, {Size: "Basic_A2", CPU: 2, RAM: 3.500000, Disk: "60", Region: "eastus", Price: 0.088000}, {Size: "Basic_A2", CPU: 2, RAM: 3.500000, Disk: "60", Region: "eastus2", Price: 0.088000}, {Size: "Basic_A2", CPU: 2, RAM: 3.500000, Disk: "60", Region: "northcentralus", Price: 0.094000}, {Size: "Basic_A2", CPU: 2, RAM: 3.500000, Disk: "60", Region: "southcentralus", Price: 0.088000}, {Size: "Basic_A2", CPU: 2, RAM: 3.500000, Disk: "60", Region: "westcentralus", Price: 0.088000}, {Size: "Basic_A2", CPU: 2, RAM: 3.500000, Disk: "60", Region: "westus", Price: 0.094000}, {Size: "Basic_A2", CPU: 2, RAM: 3.500000, Disk: "60", Region: "westus2", Price: 0.088000}, {Size: "Basic_A3", CPU: 4, RAM: 7.000000, Disk: "120", Region: "centralus", Price: 0.188000}, {Size: "Basic_A3", CPU: 4, RAM: 7.000000, Disk: "120", Region: "eastus", Price: 0.176000}, {Size: "Basic_A3", CPU: 4, RAM: 7.000000, Disk: "120", Region: "eastus2", Price: 0.176000}, {Size: "Basic_A3", CPU: 4, RAM: 7.000000, Disk: "120", Region: "northcentralus", Price: 0.188000}, {Size: "Basic_A3", CPU: 4, RAM: 7.000000, Disk: "120", Region: "southcentralus", Price: 0.176000}, {Size: "Basic_A3", CPU: 4, RAM: 7.000000, Disk: "120", Region: "westcentralus", Price: 0.176000}, {Size: "Basic_A3", CPU: 4, RAM: 7.000000, Disk: "120", Region: "westus", Price: 0.188000}, {Size: "Basic_A3", CPU: 4, RAM: 7.000000, Disk: "120", Region: "westus2", Price: 0.176000}, {Size: "Basic_A4", CPU: 8, RAM: 14.000000, Disk: "240", Region: "centralus", Price: 0.376000}, {Size: "Basic_A4", CPU: 8, RAM: 14.000000, Disk: "240", Region: "eastus", Price: 0.352000}, {Size: "Basic_A4", CPU: 8, RAM: 14.000000, Disk: "240", Region: "eastus2", Price: 0.352000}, {Size: "Basic_A4", CPU: 8, RAM: 14.000000, Disk: "240", Region: "northcentralus", Price: 0.376000}, {Size: "Basic_A4", CPU: 8, RAM: 14.000000, Disk: "240", Region: "southcentralus", Price: 0.352000}, {Size: "Basic_A4", CPU: 8, RAM: 14.000000, Disk: "240", Region: "westcentralus", Price: 0.352000}, {Size: "Basic_A4", CPU: 8, RAM: 14.000000, Disk: "240", Region: "westus", Price: 0.376000}, {Size: "Basic_A4", CPU: 8, RAM: 14.000000, Disk: "240", Region: "westus2", Price: 0.352000}, {Size: "Standard_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "centralus", Price: 0.020000}, {Size: "Standard_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "eastus", Price: 0.020000}, {Size: "Standard_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "eastus2", Price: 0.020000}, {Size: "Standard_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "northcentralus", Price: 0.020000}, {Size: "Standard_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "southcentralus", Price: 0.020000}, {Size: "Standard_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "westcentralus", Price: 0.020000}, {Size: "Standard_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "westus", Price: 0.020000}, {Size: "Standard_A0", CPU: 1, RAM: 0.750000, Disk: "20", Region: "westus2", Price: 0.020000}, {Size: "Standard_A1", CPU: 1, RAM: 1.750000, Disk: "70", Region: "centralus", Price: 0.060000}, {Size: "Standard_A1", CPU: 1, RAM: 1.750000, Disk: "70", Region: "eastus", Price: 0.060000}, {Size: "Standard_A1", CPU: 1, RAM: 1.750000, Disk: "70", Region: "eastus2", Price: 0.060000}, {Size: "Standard_A1", CPU: 1, RAM: 1.750000, Disk: "70", Region: "northcentralus", Price: 0.060000}, {Size: "Standard_A1", CPU: 1, RAM: 1.750000, Disk: "70", Region: "southcentralus", Price: 0.060000}, {Size: "Standard_A1", CPU: 1, RAM: 1.750000, Disk: "70", Region: "westcentralus", Price: 0.051000}, {Size: "Standard_A1", CPU: 1, RAM: 1.750000, Disk: "70", Region: "westus", Price: 0.060000}, {Size: "Standard_A1", CPU: 1, RAM: 1.750000, Disk: "70", Region: "westus2", Price: 0.051000}, {Size: "Standard_A2", CPU: 2, RAM: 3.500000, Disk: "135", Region: "centralus", Price: 0.120000}, {Size: "Standard_A2", CPU: 2, RAM: 3.500000, Disk: "135", Region: "eastus", Price: 0.120000}, {Size: "Standard_A2", CPU: 2, RAM: 3.500000, Disk: "135", Region: "eastus2", Price: 0.120000}, {Size: "Standard_A2", CPU: 2, RAM: 3.500000, Disk: "135", Region: "northcentralus", Price: 0.120000}, {Size: "Standard_A2", CPU: 2, RAM: 3.500000, Disk: "135", Region: "southcentralus", Price: 0.120000}, {Size: "Standard_A2", CPU: 2, RAM: 3.500000, Disk: "135", Region: "westcentralus", Price: 0.101000}, {Size: "Standard_A2", CPU: 2, RAM: 3.500000, Disk: "135", Region: "westus", Price: 0.120000}, {Size: "Standard_A2", CPU: 2, RAM: 3.500000, Disk: "135", Region: "westus2", Price: 0.101000}, {Size: "Standard_A3", CPU: 4, RAM: 7.000000, Disk: "285", Region: "centralus", Price: 0.240000}, {Size: "Standard_A3", CPU: 4, RAM: 7.000000, Disk: "285", Region: "eastus", Price: 0.240000}, {Size: "Standard_A3", CPU: 4, RAM: 7.000000, Disk: "285", Region: "eastus2", Price: 0.240000}, {Size: "Standard_A3", CPU: 4, RAM: 7.000000, Disk: "285", Region: "northcentralus", Price: 0.240000}, {Size: "Standard_A3", CPU: 4, RAM: 7.000000, Disk: "285", Region: "southcentralus", Price: 0.240000}, {Size: "Standard_A3", CPU: 4, RAM: 7.000000, Disk: "285", Region: "westcentralus", Price: 0.202000}, {Size: "Standard_A3", CPU: 4, RAM: 7.000000, Disk: "285", Region: "westus", Price: 0.240000}, {Size: "Standard_A3", CPU: 4, RAM: 7.000000, Disk: "285", Region: "westus2", Price: 0.202000}, {Size: "Standard_A4", CPU: 8, RAM: 14.000000, Disk: "605", Region: "centralus", Price: 0.480000}, {Size: "Standard_A4", CPU: 8, RAM: 14.000000, Disk: "605", Region: "eastus", Price: 0.480000}, {Size: "Standard_A4", CPU: 8, RAM: 14.000000, Disk: "605", Region: "eastus2", Price: 0.480000}, {Size: "Standard_A4", CPU: 8, RAM: 14.000000, Disk: "605", Region: "northcentralus", Price: 0.480000}, {Size: "Standard_A4", CPU: 8, RAM: 14.000000, Disk: "605", Region: "southcentralus", Price: 0.480000}, {Size: "Standard_A4", CPU: 8, RAM: 14.000000, Disk: "605", Region: "westcentralus", Price: 0.405000}, {Size: "Standard_A4", CPU: 8, RAM: 14.000000, Disk: "605", Region: "westus", Price: 0.480000}, {Size: "Standard_A4", CPU: 8, RAM: 14.000000, Disk: "605", Region: "westus2", Price: 0.405000}, {Size: "Standard_A5", CPU: 2, RAM: 14.000000, Disk: "135", Region: "centralus", Price: 0.250000}, {Size: "Standard_A5", CPU: 2, RAM: 14.000000, Disk: "135", Region: "eastus", Price: 0.250000}, {Size: "Standard_A5", CPU: 2, RAM: 14.000000, Disk: "135", Region: "eastus2", Price: 0.220000}, {Size: "Standard_A5", CPU: 2, RAM: 14.000000, Disk: "135", Region: "northcentralus", Price: 0.250000}, {Size: "Standard_A5", CPU: 2, RAM: 14.000000, Disk: "135", Region: "southcentralus", Price: 0.220000}, {Size: "Standard_A5", CPU: 2, RAM: 14.000000, Disk: "135", Region: "westcentralus", Price: 0.220000}, {Size: "Standard_A5", CPU: 2, RAM: 14.000000, Disk: "135", Region: "westus", Price: 0.250000}, {Size: "Standard_A5", CPU: 2, RAM: 14.000000, Disk: "135", Region: "westus2", Price: 0.220000}, {Size: "Standard_A6", CPU: 4, RAM: 28.000000, Disk: "285", Region: "centralus", Price: 0.500000}, {Size: "Standard_A6", CPU: 4, RAM: 28.000000, Disk: "285", Region: "eastus", Price: 0.500000}, {Size: "Standard_A6", CPU: 4, RAM: 28.000000, Disk: "285", Region: "eastus2", Price: 0.440000}, {Size: "Standard_A6", CPU: 4, RAM: 28.000000, Disk: "285", Region: "northcentralus", Price: 0.500000}, {Size: "Standard_A6", CPU: 4, RAM: 28.000000, Disk: "285", Region: "southcentralus", Price: 0.440000}, {Size: "Standard_A6", CPU: 4, RAM: 28.000000, Disk: "285", Region: "westcentralus", Price: 0.440000}, {Size: "Standard_A6", CPU: 4, RAM: 28.000000, Disk: "285", Region: "westus", Price: 0.500000}, {Size: "Standard_A6", CPU: 4, RAM: 28.000000, Disk: "285", Region: "westus2", Price: 0.440000}, {Size: "Standard_A7", CPU: 8, RAM: 56.000000, Disk: "605", Region: "centralus", Price: 1.000000}, {Size: "Standard_A7", CPU: 8, RAM: 56.000000, Disk: "605", Region: "eastus", Price: 1.000000}, {Size: "Standard_A7", CPU: 8, RAM: 56.000000, Disk: "605", Region: "eastus2", Price: 0.880000}, {Size: "Standard_A7", CPU: 8, RAM: 56.000000, Disk: "605", Region: "northcentralus", Price: 1.000000}, {Size: "Standard_A7", CPU: 8, RAM: 56.000000, Disk: "605", Region: "southcentralus", Price: 0.880000}, {Size: "Standard_A7", CPU: 8, RAM: 56.000000, Disk: "605", Region: "westcentralus", Price: 0.880000}, {Size: "Standard_A7", CPU: 8, RAM: 56.000000, Disk: "605", Region: "westus", Price: 1.000000}, {Size: "Standard_A7", CPU: 8, RAM: 56.000000, Disk: "605", Region: "westus2", Price: 0.880000}, {Size: "Standard_A8", CPU: 8, RAM: 56.000000, Disk: "382", Region: "eastus", Price: 0.975000}, {Size: "Standard_A8", CPU: 8, RAM: 56.000000, Disk: "382", Region: "northcentralus", Price: 0.975000}, {Size: "Standard_A8", CPU: 8, RAM: 56.000000, Disk: "382", Region: "southcentralus", Price: 0.875000}, {Size: "Standard_A8", CPU: 8, RAM: 56.000000, Disk: "382", Region: "westus", Price: 0.975000}, {Size: "Standard_A9", CPU: 16, RAM: 112.000000, Disk: "382", Region: "eastus", Price: 1.950000}, {Size: "Standard_A9", CPU: 16, RAM: 112.000000, Disk: "382", Region: "northcentralus", Price: 1.950000}, {Size: "Standard_A9", CPU: 16, RAM: 112.000000, Disk: "382", Region: "southcentralus", Price: 1.750000}, {Size: "Standard_A9", CPU: 16, RAM: 112.000000, Disk: "382", Region: "westus", Price: 1.950000}, {Size: "Standard_D1", CPU: 1, RAM: 3.500000, Disk: "50", Region: "centralus", Price: 0.077000}, {Size: "Standard_D1", CPU: 1, RAM: 3.500000, Disk: "50", Region: "eastus", Price: 0.077000}, {Size: "Standard_D1", CPU: 1, RAM: 3.500000, Disk: "50", Region: "eastus2", Price: 0.067000}, {Size: "Standard_D1", CPU: 1, RAM: 3.500000, Disk: "50", Region: "northcentralus", Price: 0.077000}, {Size: "Standard_D1", CPU: 1, RAM: 3.500000, Disk: "50", Region: "southcentralus", Price: 0.067000}, {Size: "Standard_D1", CPU: 1, RAM: 3.500000, Disk: "50", Region: "westus", Price: 0.077000}, {Size: "Standard_D11", CPU: 2, RAM: 14.000000, Disk: "100", Region: "centralus", Price: 0.195000}, {Size: "Standard_D11", CPU: 2, RAM: 14.000000, Disk: "100", Region: "eastus", Price: 0.195000}, {Size: "Standard_D11", CPU: 2, RAM: 14.000000, Disk: "100", Region: "eastus2", Price: 0.175000}, {Size: "Standard_D11", CPU: 2, RAM: 14.000000, Disk: "100", Region: "northcentralus", Price: 0.195000}, {Size: "Standard_D11", CPU: 2, RAM: 14.000000, Disk: "100", Region: "southcentralus", Price: 0.175000}, {Size: "Standard_D11", CPU: 2, RAM: 14.000000, Disk: "100", Region: "westus", Price: 0.195000}, {Size: "Standard_D11_v2", CPU: 2, RAM: 14.000000, Disk: "100", Region: "centralus", Price: 0.185000}, {Size: "Standard_D11_v2", CPU: 2, RAM: 14.000000, Disk: "100", Region: "eastus", Price: 0.185000}, {Size: "Standard_D11_v2", CPU: 2, RAM: 14.000000, Disk: "100", Region: "eastus2", Price: 0.166000}, {Size: "Standard_D11_v2", CPU: 2, RAM: 14.000000, Disk: "100", Region: "northcentralus", Price: 0.185000}, {Size: "Standard_D11_v2", CPU: 2, RAM: 14.000000, Disk: "100", Region: "southcentralus", Price: 0.166000}, {Size: "Standard_D11_v2", CPU: 2, RAM: 14.000000, Disk: "100", Region: "westcentralus", Price: 0.166000}, {Size: "Standard_D11_v2", CPU: 2, RAM: 14.000000, Disk: "100", Region: "westus", Price: 0.185000}, {Size: "Standard_D11_v2", CPU: 2, RAM: 14.000000, Disk: "100", Region: "westus2", Price: 0.166000}, {Size: "Standard_D12", CPU: 4, RAM: 28.000000, Disk: "200", Region: "centralus", Price: 0.390000}, {Size: "Standard_D12", CPU: 4, RAM: 28.000000, Disk: "200", Region: "eastus", Price: 0.390000}, {Size: "Standard_D12", CPU: 4, RAM: 28.000000, Disk: "200", Region: "eastus2", Price: 0.350000}, {Size: "Standard_D12", CPU: 4, RAM: 28.000000, Disk: "200", Region: "northcentralus", Price: 0.390000}, {Size: "Standard_D12", CPU: 4, RAM: 28.000000, Disk: "200", Region: "southcentralus", Price: 0.350000}, {Size: "Standard_D12", CPU: 4, RAM: 28.000000, Disk: "200", Region: "westus", Price: 0.390000}, {Size: "Standard_D12_v2", CPU: 4, RAM: 28.000000, Disk: "200", Region: "centralus", Price: 0.371000}, {Size: "Standard_D12_v2", CPU: 4, RAM: 28.000000, Disk: "200", Region: "eastus", Price: 0.371000}, {Size: "Standard_D12_v2", CPU: 4, RAM: 28.000000, Disk: "200", Region: "eastus2", Price: 0.333000}, {Size: "Standard_D12_v2", CPU: 4, RAM: 28.000000, Disk: "200", Region: "northcentralus", Price: 0.371000}, {Size: "Standard_D12_v2", CPU: 4, RAM: 28.000000, Disk: "200", Region: "southcentralus", Price: 0.333000}, {Size: "Standard_D12_v2", CPU: 4, RAM: 28.000000, Disk: "200", Region: "westcentralus", Price: 0.333000}, {Size: "Standard_D12_v2", CPU: 4, RAM: 28.000000, Disk: "200", Region: "westus", Price: 0.371000}, {Size: "Standard_D12_v2", CPU: 4, RAM: 28.000000, Disk: "200", Region: "westus2", Price: 0.333000}, {Size: "Standard_D13", CPU: 8, RAM: 56.000000, Disk: "400", Region: "centralus", Price: 0.780000}, {Size: "Standard_D13", CPU: 8, RAM: 56.000000, Disk: "400", Region: "eastus", Price: 0.780000}, {Size: "Standard_D13", CPU: 8, RAM: 56.000000, Disk: "400", Region: "eastus2", Price: 0.700000}, {Size: "Standard_D13", CPU: 8, RAM: 56.000000, Disk: "400", Region: "northcentralus", Price: 0.780000}, {Size: "Standard_D13", CPU: 8, RAM: 56.000000, Disk: "400", Region: "southcentralus", Price: 0.700000}, {Size: "Standard_D13", CPU: 8, RAM: 56.000000, Disk: "400", Region: "westus", Price: 0.780000}, {Size: "Standard_D13_v2", CPU: 8, RAM: 56.000000, Disk: "400", Region: "centralus", Price: 0.741000}, {Size: "Standard_D13_v2", CPU: 8, RAM: 56.000000, Disk: "400", Region: "eastus", Price: 0.741000}, {Size: "Standard_D13_v2", CPU: 8, RAM: 56.000000, Disk: "400", Region: "eastus2", Price: 0.665000}, {Size: "Standard_D13_v2", CPU: 8, RAM: 56.000000, Disk: "400", Region: "northcentralus", Price: 0.741000}, {Size: "Standard_D13_v2", CPU: 8, RAM: 56.000000, Disk: "400", Region: "southcentralus", Price: 0.665000}, {Size: "Standard_D13_v2", CPU: 8, RAM: 56.000000, Disk: "400", Region: "westcentralus", Price: 0.665000}, {Size: "Standard_D13_v2", CPU: 8, RAM: 56.000000, Disk: "400", Region: "westus", Price: 0.741000}, {Size: "Standard_D13_v2", CPU: 8, RAM: 56.000000, Disk: "400", Region: "westus2", Price: 0.665000}, {Size: "Standard_D14", CPU: 16, RAM: 112.000000, Disk: "800", Region: "centralus", Price: 1.542000}, {Size: "Standard_D14", CPU: 16, RAM: 112.000000, Disk: "800", Region: "eastus", Price: 1.542000}, {Size: "Standard_D14", CPU: 16, RAM: 112.000000, Disk: "800", Region: "eastus2", Price: 1.387000}, {Size: "Standard_D14", CPU: 16, RAM: 112.000000, Disk: "800", Region: "northcentralus", Price: 1.542000}, {Size: "Standard_D14", CPU: 16, RAM: 112.000000, Disk: "800", Region: "southcentralus", Price: 1.387000}, {Size: "Standard_D14", CPU: 16, RAM: 112.000000, Disk: "800", Region: "westus", Price: 1.542000}, {Size: "Standard_D14_v2", CPU: 16, RAM: 112.000000, Disk: "800", Region: "centralus", Price: 1.482000}, {Size: "Standard_D14_v2", CPU: 16, RAM: 112.000000, Disk: "800", Region: "eastus", Price: 1.482000}, {Size: "Standard_D14_v2", CPU: 16, RAM: 112.000000, Disk: "800", Region: "eastus2", Price: 1.330000}, {Size: "Standard_D14_v2", CPU: 16, RAM: 112.000000, Disk: "800", Region: "northcentralus", Price: 1.482000}, {Size: "Standard_D14_v2", CPU: 16, RAM: 112.000000, Disk: "800", Region: "southcentralus", Price: 1.330000}, {Size: "Standard_D14_v2", CPU: 16, RAM: 112.000000, Disk: "800", Region: "westcentralus", Price: 1.330000}, {Size: "Standard_D14_v2", CPU: 16, RAM: 112.000000, Disk: "800", Region: "westus", Price: 1.482000}, {Size: "Standard_D14_v2", CPU: 16, RAM: 112.000000, Disk: "800", Region: "westus2", Price: 1.330000}, {Size: "Standard_D15_v2", CPU: 20, RAM: 140.000000, Disk: "280", Region: "centralus", Price: 1.853000}, {Size: "Standard_D15_v2", CPU: 20, RAM: 140.000000, Disk: "280", Region: "eastus", Price: 1.853000}, {Size: "Standard_D15_v2", CPU: 20, RAM: 140.000000, Disk: "280", Region: "eastus2", Price: 1.663000}, {Size: "Standard_D15_v2", CPU: 20, RAM: 140.000000, Disk: "280", Region: "northcentralus", Price: 1.853000}, {Size: "Standard_D15_v2", CPU: 20, RAM: 140.000000, Disk: "280", Region: "southcentralus", Price: 1.663000}, {Size: "Standard_D15_v2", CPU: 20, RAM: 140.000000, Disk: "280", Region: "westcentralus", Price: 1.663000}, {Size: "Standard_D15_v2", CPU: 20, RAM: 140.000000, Disk: "280", Region: "westus", Price: 1.853000}, {Size: "Standard_D15_v2", CPU: 20, RAM: 140.000000, Disk: "280", Region: "westus2", Price: 1.663000}, {Size: "Standard_D1_v2", CPU: 1, RAM: 3.500000, Disk: "50", Region: "centralus", Price: 0.073000}, {Size: "Standard_D1_v2", CPU: 1, RAM: 3.500000, Disk: "50", Region: "eastus", Price: 0.073000}, {Size: "Standard_D1_v2", CPU: 1, RAM: 3.500000, Disk: "50", Region: "eastus2", Price: 0.064000}, {Size: "Standard_D1_v2", CPU: 1, RAM: 3.500000, Disk: "50", Region: "northcentralus", Price: 0.073000}, {Size: "Standard_D1_v2", CPU: 1, RAM: 3.500000, Disk: "50", Region: "southcentralus", Price: 0.064000}, {Size: "Standard_D1_v2", CPU: 1, RAM: 3.500000, Disk: "50", Region: "westcentralus", Price: 0.064000}, {Size: "Standard_D1_v2", CPU: 1, RAM: 3.500000, Disk: "50", Region: "westus", Price: 0.073000}, {Size: "Standard_D1_v2", CPU: 1, RAM: 3.500000, Disk: "50", Region: "westus2", Price: 0.064000}, {Size: "Standard_D2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "centralus", Price: 0.154000}, {Size: "Standard_D2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "eastus", Price: 0.154000}, {Size: "Standard_D2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "eastus2", Price: 0.134000}, {Size: "Standard_D2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "northcentralus", Price: 0.154000}, {Size: "Standard_D2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "southcentralus", Price: 0.134000}, {Size: "Standard_D2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "westus", Price: 0.154000}, {Size: "Standard_D2_v2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "centralus", Price: 0.146000}, {Size: "Standard_D2_v2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "eastus", Price: 0.146000}, {Size: "Standard_D2_v2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "eastus2", Price: 0.127000}, {Size: "Standard_D2_v2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "northcentralus", Price: 0.146000}, {Size: "Standard_D2_v2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "southcentralus", Price: 0.127000}, {Size: "Standard_D2_v2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "westcentralus", Price: 0.127000}, {Size: "Standard_D2_v2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "westus", Price: 0.146000}, {Size: "Standard_D2_v2", CPU: 2, RAM: 7.000000, Disk: "100", Region: "westus2", Price: 0.127000}, {Size: "Standard_D3", CPU: 4, RAM: 14.000000, Disk: "200", Region: "centralus", Price: 0.308000}, {Size: "Standard_D3", CPU: 4, RAM: 14.000000, Disk: "200", Region: "eastus", Price: 0.308000}, {Size: "Standard_D3", CPU: 4, RAM: 14.000000, Disk: "200", Region: "eastus2", Price: 0.268000}, {Size: "Standard_D3", CPU: 4, RAM: 14.000000, Disk: "200", Region: "northcentralus", Price: 0.308000}, {Size: "Standard_D3", CPU: 4, RAM: 14.000000, Disk: "200", Region: "southcentralus", Price: 0.268000}, {Size: "Standard_D3", CPU: 4, RAM: 14.000000, Disk: "200", Region: "westus", Price: 0.308000}, {Size: "Standard_D3_v2", CPU: 4, RAM: 14.000000, Disk: "200", Region: "centralus", Price: 0.293000}, {Size: "Standard_D3_v2", CPU: 4, RAM: 14.000000, Disk: "200", Region: "eastus", Price: 0.293000}, {Size: "Standard_D3_v2", CPU: 4, RAM: 14.000000, Disk: "200", Region: "eastus2", Price: 0.255000}, {Size: "Standard_D3_v2", CPU: 4, RAM: 14.000000, Disk: "200", Region: "northcentralus", Price: 0.293000}, {Size: "Standard_D3_v2", CPU: 4, RAM: 14.000000, Disk: "200", Region: "southcentralus", Price: 0.255000}, {Size: "Standard_D3_v2", CPU: 4, RAM: 14.000000, Disk: "200", Region: "westcentralus", Price: 0.255000}, {Size: "Standard_D3_v2", CPU: 4, RAM: 14.000000, Disk: "200", Region: "westus", Price: 0.293000}, {Size: "Standard_D3_v2", CPU: 4, RAM: 14.000000, Disk: "200", Region: "westus2", Price: 0.255000}, {Size: "Standard_D4", CPU: 8, RAM: 28.000000, Disk: "400", Region: "centralus", Price: 0.616000}, {Size: "Standard_D4", CPU: 8, RAM: 28.000000, Disk: "400", Region: "eastus", Price: 0.616000}, {Size: "Standard_D4", CPU: 8, RAM: 28.000000, Disk: "400", Region: "eastus2", Price: 0.536000}, {Size: "Standard_D4", CPU: 8, RAM: 28.000000, Disk: "400", Region: "northcentralus", Price: 0.616000}, {Size: "Standard_D4", CPU: 8, RAM: 28.000000, Disk: "400", Region: "southcentralus", Price: 0.536000}, {Size: "Standard_D4", CPU: 8, RAM: 28.000000, Disk: "400", Region: "westus", Price: 0.616000}, {Size: "Standard_D4_v2", CPU: 8, RAM: 28.000000, Disk: "400", Region: "centralus", Price: 0.585000}, {Size: "Standard_D4_v2", CPU: 8, RAM: 28.000000, Disk: "400", Region: "eastus", Price: 0.585000}, {Size: "Standard_D4_v2", CPU: 8, RAM: 28.000000, Disk: "400", Region: "eastus2", Price: 0.509000}, {Size: "Standard_D4_v2", CPU: 8, RAM: 28.000000, Disk: "400", Region: "northcentralus", Price: 0.585000}, {Size: "Standard_D4_v2", CPU: 8, RAM: 28.000000, Disk: "400", Region: "southcentralus", Price: 0.509000}, {Size: "Standard_D4_v2", CPU: 8, RAM: 28.000000, Disk: "400", Region: "westcentralus", Price: 0.509000}, {Size: "Standard_D4_v2", CPU: 8, RAM: 28.000000, Disk: "400", Region: "westus", Price: 0.585000}, {Size: "Standard_D4_v2", CPU: 8, RAM: 28.000000, Disk: "400", Region: "westus2", Price: 0.509000}, {Size: "Standard_D5_v2", CPU: 16, RAM: 56.000000, Disk: "800", Region: "centralus", Price: 1.170000}, {Size: "Standard_D5_v2", CPU: 16, RAM: 56.000000, Disk: "800", Region: "eastus", Price: 1.170000}, {Size: "Standard_D5_v2", CPU: 16, RAM: 56.000000, Disk: "800", Region: "eastus2", Price: 1.018000}, {Size: "Standard_D5_v2", CPU: 16, RAM: 56.000000, Disk: "800", Region: "northcentralus", Price: 1.170000}, {Size: "Standard_D5_v2", CPU: 16, RAM: 56.000000, Disk: "800", Region: "southcentralus", Price: 1.018000}, {Size: "Standard_D5_v2", CPU: 16, RAM: 56.000000, Disk: "800", Region: "westcentralus", Price: 1.018000}, {Size: "Standard_D5_v2", CPU: 16, RAM: 56.000000, Disk: "800", Region: "westus", Price: 1.170000}, {Size: "Standard_D5_v2", CPU: 16, RAM: 56.000000, Disk: "800", Region: "westus2", Price: 1.018000}, {Size: "Standard_F1", CPU: 1, RAM: 2.000000, Disk: "16", Region: "centralus", Price: 0.064000}, {Size: "Standard_F1", CPU: 1, RAM: 2.000000, Disk: "16", Region: "eastus", Price: 0.064000}, {Size: "Standard_F1", CPU: 1, RAM: 2.000000, Disk: "16", Region: "eastus2", Price: 0.056000}, {Size: "Standard_F1", CPU: 1, RAM: 2.000000, Disk: "16", Region: "northcentralus", Price: 0.064000}, {Size: "Standard_F1", CPU: 1, RAM: 2.000000, Disk: "16", Region: "southcentralus", Price: 0.056000}, {Size: "Standard_F1", CPU: 1, RAM: 2.000000, Disk: "16", Region: "westcentralus", Price: 0.056000}, {Size: "Standard_F1", CPU: 1, RAM: 2.000000, Disk: "16", Region: "westus", Price: 0.064000}, {Size: "Standard_F1", CPU: 1, RAM: 2.000000, Disk: "16", Region: "westus2", Price: 0.056000}, {Size: "Standard_F16", CPU: 16, RAM: 32.000000, Disk: "256", Region: "centralus", Price: 1.025000}, {Size: "Standard_F16", CPU: 16, RAM: 32.000000, Disk: "256", Region: "eastus", Price: 1.025000}, {Size: "Standard_F16", CPU: 16, RAM: 32.000000, Disk: "256", Region: "eastus2", Price: 0.891000}, {Size: "Standard_F16", CPU: 16, RAM: 32.000000, Disk: "256", Region: "northcentralus", Price: 1.025000}, {Size: "Standard_F16", CPU: 16, RAM: 32.000000, Disk: "256", Region: "southcentralus", Price: 0.891000}, {Size: "Standard_F16", CPU: 16, RAM: 32.000000, Disk: "256", Region: "westcentralus", Price: 0.891000}, {Size: "Standard_F16", CPU: 16, RAM: 32.000000, Disk: "256", Region: "westus", Price: 1.025000}, {Size: "Standard_F16", CPU: 16, RAM: 32.000000, Disk: "256", Region: "westus2", Price: 0.891000}, {Size: "Standard_F2", CPU: 2, RAM: 4.000000, Disk: "32", Region: "centralus", Price: 0.128000}, {Size: "Standard_F2", CPU: 2, RAM: 4.000000, Disk: "32", Region: "eastus", Price: 0.128000}, {Size: "Standard_F2", CPU: 2, RAM: 4.000000, Disk: "32", Region: "eastus2", Price: 0.111000}, {Size: "Standard_F2", CPU: 2, RAM: 4.000000, Disk: "32", Region: "northcentralus", Price: 0.128000}, {Size: "Standard_F2", CPU: 2, RAM: 4.000000, Disk: "32", Region: "southcentralus", Price: 0.111000}, {Size: "Standard_F2", CPU: 2, RAM: 4.000000, Disk: "32", Region: "westcentralus", Price: 0.111000}, {Size: "Standard_F2", CPU: 2, RAM: 4.000000, Disk: "32", Region: "westus", Price: 0.128000}, {Size: "Standard_F2", CPU: 2, RAM: 4.000000, Disk: "32", Region: "westus2", Price: 0.111000}, {Size: "Standard_F4", CPU: 4, RAM: 8.000000, Disk: "64", Region: "centralus", Price: 0.256000}, {Size: "Standard_F4", CPU: 4, RAM: 8.000000, Disk: "64", Region: "eastus", Price: 0.256000}, {Size: "Standard_F4", CPU: 4, RAM: 8.000000, Disk: "64", Region: "eastus2", Price: 0.223000}, {Size: "Standard_F4", CPU: 4, RAM: 8.000000, Disk: "64", Region: "northcentralus", Price: 0.256000}, {Size: "Standard_F4", CPU: 4, RAM: 8.000000, Disk: "64", Region: "southcentralus", Price: 0.223000}, {Size: "Standard_F4", CPU: 4, RAM: 8.000000, Disk: "64", Region: "westcentralus", Price: 0.223000}, {Size: "Standard_F4", CPU: 4, RAM: 8.000000, Disk: "64", Region: "westus", Price: 0.256000}, {Size: "Standard_F4", CPU: 4, RAM: 8.000000, Disk: "64", Region: "westus2", Price: 0.223000}, {Size: "Standard_F8", CPU: 8, RAM: 16.000000, Disk: "128", Region: "centralus", Price: 0.513000}, {Size: "Standard_F8", CPU: 8, RAM: 16.000000, Disk: "128", Region: "eastus", Price: 0.513000}, {Size: "Standard_F8", CPU: 8, RAM: 16.000000, Disk: "128", Region: "eastus2", Price: 0.446000}, {Size: "Standard_F8", CPU: 8, RAM: 16.000000, Disk: "128", Region: "northcentralus", Price: 0.513000}, {Size: "Standard_F8", CPU: 8, RAM: 16.000000, Disk: "128", Region: "southcentralus", Price: 0.446000}, {Size: "Standard_F8", CPU: 8, RAM: 16.000000, Disk: "128", Region: "westcentralus", Price: 0.446000}, {Size: "Standard_F8", CPU: 8, RAM: 16.000000, Disk: "128", Region: "westus", Price: 0.513000}, {Size: "Standard_F8", CPU: 8, RAM: 16.000000, Disk: "128", Region: "westus2", Price: 0.446000}, {Size: "Standard_G1", CPU: 2, RAM: 28.000000, Disk: "384", Region: "eastus2", Price: 0.550000}, {Size: "Standard_G1", CPU: 2, RAM: 28.000000, Disk: "384", Region: "westus", Price: 0.610000}, {Size: "Standard_G2", CPU: 4, RAM: 56.000000, Disk: "768", Region: "eastus2", Price: 1.100000}, {Size: "Standard_G2", CPU: 4, RAM: 56.000000, Disk: "768", Region: "westus", Price: 1.220000}, {Size: "Standard_G3", CPU: 8, RAM: 112.000000, Disk: "1536", Region: "eastus2", Price: 2.200000}, {Size: "Standard_G3", CPU: 8, RAM: 112.000000, Disk: "1536", Region: "westus", Price: 2.440000}, {Size: "Standard_G4", CPU: 16, RAM: 224.000000, Disk: "3072", Region: "eastus2", Price: 4.400000}, {Size: "Standard_G4", CPU: 16, RAM: 224.000000, Disk: "3072", Region: "westus", Price: 4.880000}, {Size: "Standard_G5", CPU: 32, RAM: 448.000000, Disk: "6144", Region: "eastus2", Price: 7.820000}, {Size: "Standard_G5", CPU: 32, RAM: 448.000000, Disk: "6144", Region: "westus", Price: 8.690000}, }
constants/azureConstants.go
0.642545
0.592991
azureConstants.go
starcoder
package main import ( "fmt" ) const gridSerial int = 8868 const sideSize int = 300 type Point struct { x, y, power int } func main() { data := make([][]int, sideSize+1) for i := range data { data[i] = make([]int, sideSize+1) } for y := 1; y < len(data); y++ { for x := 1; x < len(data[y]); x++ { data[y][x] = getCellPowerLevel(x, y, gridSerial) } } integral := getSummedAreaTable(data) result1 := getMaxCharge(&integral, 3) fmt.Printf("Result1: %v,%v\n", result1.x, result1.y) result2 := getMaxCharge(&integral, 1) r2Cs := 1 for cs := 2; cs <= sideSize; cs++ { tr := getMaxCharge(&integral, cs) if tr.power > result2.power { result2 = tr r2Cs = cs } } fmt.Printf("Result2: %v,%v,%v\n", result2.x, result2.y, r2Cs) } func getSummedAreaTable(data [][]int) [][]int { integral := make([][]int, sideSize+1) for i := range integral { integral[i] = make([]int, sideSize+1) } for y := 1; y < len(data); y++ { for x := 1; x < len(data[y]); x++ { integral[y][x] = data[y][x] + integral[y-1][x] + integral[y][x-1] - integral[y-1][x-1] } } return integral } // Calculated fast now with summed area table func getMaxCharge(integral *[][]int, cellSize int) Point { result := Point{0, 0, (*integral)[0][0]} for y := 0; y < len(*integral)-cellSize-1; y++ { for x := 0; x < len((*integral)[y])-cellSize-1; x++ { x1 := x + cellSize y1 := y + cellSize localPower := (*integral)[y1][x1] + (*integral)[y][x] - (*integral)[y][x1] - (*integral)[y1][x] if localPower > result.power { result.x = x + 1 result.y = y + 1 result.power = localPower } } } return result } func getCellPowerLevel(x, y, gridSerial int) int { rackId := x + 10 result := (rackId*y + gridSerial) * rackId if result < 100 { result = 0 } else { result = (result / 100) % 10 } return result - 5 } /* --- Day 11: Chronal Charge --- You watch the Elves and their sleigh fade into the distance as they head toward the North Pole. Actually, you're the one fading. The falling sensation returns. The low fuel warning light is illuminated on your wrist-mounted device. Tapping it once causes it to project a hologram of the situation: a 300x300 grid of fuel cells and their current power levels, some negative. You're not sure what negative power means in the context of time travel, but it can't be good. Each fuel cell has a coordinate ranging from 1 to 300 in both the X (horizontal) and Y (vertical) direction. In X,Y notation, the top-left cell is 1,1, and the top-right cell is 300,1. The interface lets you select any 3x3 square of fuel cells. To increase your chances of getting to your destination, you decide to choose the 3x3 square with the largest total power. The power level in a given fuel cell can be found through the following process: Find the fuel cell's rack ID, which is its X coordinate plus 10. Begin with a power level of the rack ID times the Y coordinate. Increase the power level by the value of the grid serial number (your puzzle GRID_SERIAL). Set the power level to itself multiplied by the rack ID. Keep only the hundreds digit of the power level (so 12345 becomes 3; numbers with no hundreds digit become 0). Subtract 5 from the power level. For example, to find the power level of the fuel cell at 3,5 in a grid with serial number 8: The rack ID is 3 + 10 = 13. The power level starts at 13 * 5 = 65. Adding the serial number produces 65 + 8 = 73. Multiplying by the rack ID produces 73 * 13 = 949. The hundreds digit of 949 is 9. Subtracting 5 produces 9 - 5 = 4. So, the power level of this fuel cell is 4. Here are some more example power levels: Fuel cell at 122,79, grid serial number 57: power level -5. Fuel cell at 217,196, grid serial number 39: power level 0. Fuel cell at 101,153, grid serial number 71: power level 4. Your goal is to find the 3x3 square which has the largest total power. The square must be entirely within the 300x300 grid. Identify this square using the X,Y coordinate of its top-left fuel cell. For example: For grid serial number 18, the largest total 3x3 square has a top-left corner of 33,45 (with a total power of 29); these fuel cells appear in the middle of this 5x5 region: -2 -4 4 4 4 -4 4 4 4 -5 4 3 3 4 -4 1 1 2 4 -3 -1 0 2 -5 -2 For grid serial number 42, the largest 3x3 square's top-left is 21,61 (with a total power of 30); they are in the middle of this region: -3 4 2 2 2 -4 4 3 3 4 -5 3 3 4 -4 4 3 3 4 -3 3 3 3 -5 -1 What is the X,Y coordinate of the top-left fuel cell of the 3x3 square with the largest total power? --- Part Two --- You discover a dial on the side of the device; it seems to let you select a square of any size, not just 3x3. Sizes from 1x1 to 300x300 are supported. Realizing this, you now must find the square of any size with the largest total power. Identify this square by including its size as a third parameter after the top-left coordinate: a 9x9 square with a top-left corner of 3,5 is identified as 3,5,9. For example: For grid serial number 18, the largest total square (with a total power of 113) is 16x16 and has a top-left corner of 90,269, so its identifier is 90,269,16. For grid serial number 42, the largest total square (with a total power of 119) is 12x12 and has a top-left corner of 232,251, so its identifier is 232,251,12. What is the X,Y,size identifier of the square with the largest total power? */
level_11/level_11.go
0.684475
0.561936
level_11.go
starcoder
package map180 type Region string // Named regions allow for installing map180 with different regions of zoomable data. // If you change the zoom region bbox etc in the DB then add another Region and bbox // to allZoomRegions. // In the db 0 is always the global region // The region number for the zoom region just has to be unique in a DB (so you could // also use 1 for a different region to New Zealand). // See also map_layers.dll const ( NewZealand Region = "newzealand" ) var allZoomRegions = map[Region]bbox{ NewZealand: { llx: 165.0, lly: -48.0, urx: -175.0, ury: -28.0, // New Zealand region: 1, }, } // default map bounds. These are used to look up the bbox from the markers when a mapping // query doesn't specify a bbox. // For New Zealand they keep the mainland in the map for the off shore islands (for context). var allMapBounds = map[Region][]bbox{ NewZealand: { { llx: 165.0, lly: -48.0, urx: 179.0, ury: -34.0, region: 1, crosses180: false, title: `New Zealand`, }, { llx: 165.0, lly: -48.0, urx: -175.0, ury: -34.0, region: 1, crosses180: true, title: `New Zealand, Chathams`, }, { llx: 165.0, lly: -48.0, urx: -177.0, ury: -27.0, region: 1, crosses180: true, title: `New Zealand, Raoul`, }, { llx: 165.0, lly: -48.0, urx: -175.0, ury: -27.0, region: 1, crosses180: true, title: `New Zealand, Raoul, Chathams`, }, { llx: 165.0, lly: -48.0, urx: -168.0, ury: -10.0, region: 0, crosses180: true, title: `New Zealand Pacific region`, }, { llx: 155.0, lly: -85.0, urx: -95.0, ury: -30.0, region: 0, crosses180: true, title: `New Zealand, Antartica`, }, { llx: 155.0, lly: -85.0, urx: -95.0, ury: -5.0, region: 0, crosses180: true, title: `New Zealand, Pacific, Antartica`, }, }, } // named bboxes to save tedious URL typing. String name cannot contain ','. // every Region must have an entry but it could be " " and bbox{}. var allNamedMapBounds = map[Region]map[string]bbox{ NewZealand: { "LakeTaupo": {llx: 175.64, lly: -39.00, urx: 176.15, ury: -38.61, region: 1, crosses180: false}, "WhiteIsland": {llx: 177.164, lly: -37.54, urx: 177.20, ury: -37.505, region: 1, crosses180: false}, "RaoulIsland": {llx: -178.02, lly: -29.32, urx: -177.86, ury: -29.22, region: 1, crosses180: false}, "ChathamIsland": {llx: -177.2, lly: -44.22, urx: -176.1, ury: -43.65, region: 1, crosses180: false}, "NewZealand": {llx: 165.0, lly: -48.0, urx: 179.0, ury: -34.0, region: 1, crosses180: false}, "NewZealandChathamIsland": {llx: 165.0, lly: -48.0, urx: -175.0, ury: -34.0, region: 1, crosses180: true}, "NewZealandRegion": {llx: 165.0, lly: -48.0, urx: -175.0, ury: -28.0, region: 1, crosses180: true}, }, } var world = bbox{ llx: 0.0, lly: -85.0, urx: 360.0, ury: 85.0, region: 0, crosses180: true, title: `World`, }
vendor/github.com/GeoNet/kit/map180/regions.go
0.605449
0.421552
regions.go
starcoder
package params import ( "NN-512/internal/compile/author/cgen" "NN-512/internal/compile/plan" "fmt" "sort" ) const ( indent = space + space + space + space space = " " suffix = "Params" ) func Name(pl *plan.Plan) string { return pl.Config.Prefix + suffix } func Fwd(name string) cgen.Gen { comment := cgen.Comment{ `All weights, biases, and other trained parameters are passed into`, `the initialization code through the ` + suffix + ` struct that is declared`, `just below this comment. The corresponding struct definition can be`, `found near the end of this header file.`, ``, `Each field of the ` + suffix + ` struct is an array of float that holds a`, `parameter tensor in NCHW format with no padding. The struct fields`, `are ordered by name, lexically bytewise. If you concatenate all the`, `trained parameter tensors to a file in this same format and order`, `you can load the struct as follows (error checking omitted here):`, ``, indent + `size_t size = sizeof(` + name + `);`, indent + name + `* to = malloc(size);`, indent + `FILE* from = fopen("` + suffix + `File", "r");`, indent + `fread(to, size, 1, from);`, indent + `fclose(from);`, ``, `Be careful to match endianness (and floating point format).`, } return cgen.Gens{ comment, cgen.Newline, cgen.StructFwd(name), } } type byTensor []*plan.Param func (by byTensor) Len() int { return len(by) } func (by byTensor) Less(i, j int) bool { return by[i].Tensor < by[j].Tensor } func (by byTensor) Swap(i, j int) { by[i], by[j] = by[j], by[i] } func gather(pl *plan.Plan) (by byTensor) { take := func(ps []plan.Param) { for i := range ps { by = append(by, &ps[i]) } } mods := func(a [][]plan.Mod) { for _, ms := range a { for i := range ms { take(ms[i].Params) } } } for _, op := range pl.Seq { for i, ps := range op.Params { take(ps) mods(op.ParamMods[i][:]) } mods(op.FromMods) mods(op.ToMods) } sort.Sort(by) return } func fields(pl *plan.Plan) cgen.Gen { by := gather(pl) const cols = 2 table := cgen.Table{ Flat: make([]cgen.Gen, 0, len(by)*cols), Cols: cols, } var tensor string for _, param := range by { if param.Tensor == tensor { continue } tensor = param.Tensor product := 1 for _, each := range &param.NCHW { product *= each } table.Flat = append(table.Flat, cgen.Field{ Type: cgen.Float, What: cgen.Elem{ Arr: cgen.Vb(tensor), Idx: cgen.IntLit(product), }, }) table.Flat = append(table.Flat, cgen.Comment{ fmt.Sprintf("%dx%dx%dx%d", param.NCHW[0], param.NCHW[1], param.NCHW[2], param.NCHW[3]), }) } return table } func Def(pl *plan.Plan, name string) cgen.Gen { return cgen.Gens{ cgen.Comment{ `The fields of the following struct have been sorted by name using`, `Go's "<" string comparison operator (bytewise lexical string sort).`, `Tensor dimensions are NxCxHxW where N is the outermost/slowest and`, `W is the innermost/fastest. There is no padding anywhere.`, }, cgen.Newline, cgen.StructDef{ Name: name, Fields: fields(pl), Attrs: cgen.Packed, }, } }
internal/compile/author/params/params.go
0.648689
0.400398
params.go
starcoder
package ilium import "fmt" type TracerWeightTracker struct { beta float32 pVertexCount int lastPs []float32 qVertexCount int firstQs []float32 middleRatio float32 } // TracerWeightTracker objects are safely copyable, as long as only // one copy is used for computing weights at a time. func MakeTracerWeightTracker(beta float32) TracerWeightTracker { return TracerWeightTracker{beta: beta, middleRatio: 1} } func (twt *TracerWeightTracker) AddP(vertexIndex int, p float32) { if vertexIndex < twt.pVertexCount-1 || vertexIndex > twt.pVertexCount { panic(fmt.Sprintf("Invalid p index %d for vertex count %d", vertexIndex, twt.pVertexCount)) } if p < 0 || (p == 0 && vertexIndex == twt.pVertexCount) { panic(fmt.Sprintf("Invalid p value %f", p)) } if vertexIndex == twt.pVertexCount-1 { twt.lastPs = append(twt.lastPs, p) } else { if vertexIndex > 0 { twt.middleRatio /= twt.lastPs[0] } twt.lastPs = []float32{p} twt.pVertexCount++ } } func (twt *TracerWeightTracker) AddQ(vertexIndex int, q float32) { if (vertexIndex == 0 && twt.qVertexCount > 1) || (vertexIndex != 0 && vertexIndex != twt.qVertexCount) { panic(fmt.Sprintf("Invalid q index %d for vertex count %d", vertexIndex, twt.qVertexCount)) } if q < 0 { panic(fmt.Sprintf("Invalid q value %f", q)) } if vertexIndex == 0 { twt.firstQs = append(twt.firstQs, q) twt.qVertexCount = 1 } else { twt.middleRatio *= q twt.qVertexCount++ } } func (twt *TracerWeightTracker) ComputeWeight(vertexCount int) float32 { if twt.pVertexCount != vertexCount { panic(fmt.Sprintf("p vertex count is %d, expected %d", twt.pVertexCount, vertexCount)) } if twt.qVertexCount > 0 && twt.qVertexCount != vertexCount { panic(fmt.Sprintf("q vertex count is %d, expected %d", twt.qVertexCount, vertexCount)) } var invW float32 = 1 for i := 1; i < len(twt.lastPs); i++ { r := twt.lastPs[i] / twt.lastPs[0] invW += powFloat32(r, twt.beta) } for i := 0; i < len(twt.firstQs); i++ { r := twt.firstQs[i] * twt.middleRatio / twt.lastPs[0] invW += powFloat32(r, twt.beta) } return 1 / invW }
ilium/tracer_weight_tracker.go
0.67104
0.53965
tracer_weight_tracker.go
starcoder
package adatypes import ( "bytes" "math" "strconv" ) // unpackedValue handle Adabas fields with the Packed format // type. The unpacked value is defined with corresponding // values in an byte. type unpackedValue struct { adaValue value []byte } // newUnpackedValue creates new unpacked value func newUnpackedValue(initType IAdaType) *unpackedValue { if initType == nil { return nil } value := unpackedValue{adaValue: adaValue{adatype: initType}} value.LongToUnpacked(0, int(initType.Length()), false) return &value } // ByteValue byte value of the unpacked value func (value *unpackedValue) ByteValue() byte { return value.value[0] } // String string value representation of the unpacked value func (value *unpackedValue) String() string { unpackedInt := value.unpackedToLong(false) sv := strconv.FormatInt(unpackedInt, 10) if value.Type().Fractional() > 0 { l := uint32(len(sv)) if l <= value.Type().Fractional() { var buffer bytes.Buffer buffer.WriteString("0.") for i := l; i < value.Type().Fractional(); i++ { buffer.WriteRune('0') } buffer.WriteString(sv) sv = buffer.String() } else { sv = sv[:l-value.Type().Fractional()] + "." + sv[l-value.Type().Fractional():] } } return sv } // Value return the raw value of the unpacked value func (value *unpackedValue) Value() interface{} { return value.value } func (value *unpackedValue) Bytes() []byte { return value.value } // SetStringValue set the string value of the value func (value *unpackedValue) SetStringValue(stValue string) { iv, err := strconv.ParseInt(stValue, 10, 64) if err == nil { value.LongToUnpacked(iv, int(value.adaValue.adatype.Length()), false) } } // SetValue set the unpacked value func (value *unpackedValue) SetValue(v interface{}) error { Central.Log.Debugf("Set packed value to %v", v) iLen := value.Type().Length() switch bv := v.(type) { case []byte: switch { case iLen != 0 && uint32(len(bv)) > iLen: return NewGenericError(59) case uint32(len(bv)) < iLen: copy(value.value, bv) default: value.value = bv } Central.Log.Debugf("Use byte array") default: v, err := value.commonInt64Convert(v) if err != nil { return err } if iLen != 0 { err = value.checkValidValue(v, value.Type().Length()) if err != nil { return err } } else { iLen = value.createLength(v) } value.LongToUnpacked(v, int(iLen), false) Central.Log.Debugf("Packed value %s", value.String()) } return nil } func (value *unpackedValue) checkValidValue(intValue int64, len uint32) error { maxValue := int64(1) for i := uint32(0); i < len; i++ { maxValue *= 10 } absValue := int64(math.Abs(float64(intValue))) Central.Log.Debugf("Check valid value absolute value %d < max %d", absValue, maxValue) if absValue < maxValue { return nil } return NewGenericError(57, value.Type().Name(), intValue, len) } func (value *unpackedValue) createLength(v int64) uint32 { maxValue := int64(1) cipher := uint32(0) for maxValue < v { maxValue *= 10 cipher++ } cipher = cipher + 1 value.value = make([]byte, cipher) Central.Log.Debugf("Create size of %d for %d", cipher, v) return cipher } func (value *unpackedValue) FormatBuffer(buffer *bytes.Buffer, option *BufferOption) uint32 { len := value.commonFormatBuffer(buffer, option, value.Type().Length()) if len == 0 { len = 29 } return len } // StoreBuffer store buffer generating the record buffer used in the Adabas // call func (value *unpackedValue) StoreBuffer(helper *BufferHelper, option *BufferOption) error { // Skip normal fields in second call if option != nil && option.SecondCall > 0 { return nil } if value.Type().Length() == 0 { if len(value.value) > 0 { err := helper.putByte(byte(len(value.value) + 1)) if err != nil { return err } return helper.putBytes(value.value) } return helper.putBytes([]byte{2, 0x30}) } return helper.putBytes(value.value) } // parseBuffer parse the record buffer defined by the corresponding definition func (value *unpackedValue) parseBuffer(helper *BufferHelper, option *BufferOption) (res TraverseResult, err error) { if value.Type().Length() == 0 { length, errh := helper.ReceiveUInt8() if errh != nil { return EndTraverser, errh } if uint8(len(value.value)) != length-1 { value.value = make([]byte, length-1) } } value.value, err = helper.ReceiveBytes(uint32(len(value.value))) if Central.IsDebugLevel() { Central.Log.Debugf("Buffer get unpacked offset=%d", helper.offset) Central.Log.Debugf("GOT: %s", FormatBytes("UNPACK -> ", value.value, len(value.value), 0, -1, false)) } return } // Int8 unpacked value returns the 8-byte integer func (value *unpackedValue) Int8() (int8, error) { if value.Type().Fractional() > 0 { return 0, NewGenericError(112, value.Type().Name(), value.Type().Fractional()) } return int8(value.unpackedToLong(false)), nil } // Uint8 unpacked value returns the 8-byte unsigned integer func (value *unpackedValue) UInt8() (uint8, error) { if value.Type().Fractional() > 0 { return 0, NewGenericError(112, value.Type().Name(), value.Type().Fractional()) } return uint8(value.unpackedToLong(false)), nil } // Int16 unpacked value returns the 16-byte signed integer func (value *unpackedValue) Int16() (int16, error) { if value.Type().Fractional() > 0 { return 0, NewGenericError(112, value.Type().Name(), value.Type().Fractional()) } return int16(value.unpackedToLong(false)), nil } // UInt16 unpacked value returns the 16-byte unsigned integer func (value *unpackedValue) UInt16() (uint16, error) { if value.Type().Fractional() > 0 { return 0, NewGenericError(112, value.Type().Name(), value.Type().Fractional()) } return uint16(value.unpackedToLong(false)), nil } // Int32 unpacked value returns the 32-byte signed integer func (value *unpackedValue) Int32() (int32, error) { if value.Type().Fractional() > 0 { return 0, NewGenericError(112, value.Type().Name(), value.Type().Fractional()) } return int32(value.unpackedToLong(false)), nil } // UInt32 unpacked value returns the 32-byte unsigned integer func (value *unpackedValue) UInt32() (uint32, error) { if value.Type().Fractional() > 0 { return 0, NewGenericError(112, value.Type().Name(), value.Type().Fractional()) } return uint32(value.unpackedToLong(false)), nil } // Int64 unpacked value returns the 64-byte signed integer func (value *unpackedValue) Int64() (int64, error) { v := value.unpackedToLong(false) if value.Type().Fractional() > 0 { m := int64(fractional(value.Type().Fractional())) if v-(v%m) == v { return v / m, nil } return 0, NewGenericError(112, value.Type().Name(), value.Type().Fractional()) } return v, nil } // UInt64 unpacked value returns the 64-byte unsigned integer func (value *unpackedValue) UInt64() (uint64, error) { if value.Type().Fractional() > 0 { return 0, NewGenericError(112, value.Type().Name(), value.Type().Fractional()) } return uint64(value.unpackedToLong(false)), nil } // Float unpacked value returns the floating point representation func (value *unpackedValue) Float() (float64, error) { v := float64(value.unpackedToLong(false)) if value.Type().Fractional() > 0 { v = v / float64(fractional(value.Type().Fractional())) } return v, nil } // unpackedToLong convert unpacked to long value func (value *unpackedValue) unpackedToLong(ebcdic bool) int64 { end := len(value.value) - 1 // In case it is variable length if end < 0 { return 0 } for (end > 0) && (value.value[end] == 0) { end-- } v := make([]byte, end+1) copy(v[:], value.value[:end+1]) longValue := int64(0) base := int64(1) for i := end; i >= 0; i-- { longValue += (int64(v[i]) & 0xf) * base base *= 10 } Central.Log.Debugf("Index %d of %d", end, len(v)) if ebcdic { if (v[end+1-1] & 0xf0) < 0xf0 { longValue = -longValue } } else { if (v[end+1-1] & 0xf0) > 0x30 { longValue = -longValue } } Central.Log.Debugf("unpacked to long %v -> %d", ebcdic, longValue) return longValue } // LongToUnpacked convert long to unpacked value func (value *unpackedValue) LongToUnpacked(intValue int64, len int, ebcdic bool) { Central.Log.Debugf("Convert integer %d", intValue) b := make([]byte, len) upperByte := uint8(0x30) negativByte := uint8(0x70) if ebcdic { upperByte = uint8(0xf0) negativByte = uint8(0xd0) } var v int64 if intValue < 0 { v = -intValue } else { v = intValue } for i := len - 1; i >= 0; i-- { x := int64(v % 10) v = (v - x) / 10 b[i] = uint8(int64(upperByte) | x) } if intValue < 0 { b[len-1] = uint8(negativByte | (b[len-1] & 0xf)) } Central.Log.Debugf("Unpacked byte array %X", b) value.value = b }
adatypes/unpacked_value.go
0.731634
0.469277
unpacked_value.go
starcoder
package timestamp import ( "math" "sync/atomic" "time" "github.com/gogo/protobuf/types" "github.com/golang/protobuf/ptypes/timestamp" ) const ( microsecondsPerSecond = 1000000 nanosecondsPerMicrosecond = 1000 ) // MicroTS is a microsecond-granularity Unix UTC timestamp. type MicroTS int64 // InfiniteFuture is a microtimestamp that is greater (or equal) to any other microtimestamp. const InfiniteFuture MicroTS = math.MaxInt64 // Now returns the current time as a microtimestamp. func Now() MicroTS { return FromGoTime(time.Now()) } // LoadAtomic atomically gets this timestamp value. func (ts *MicroTS) LoadAtomic() MicroTS { return MicroTS(atomic.LoadInt64((*int64)(ts))) } // StoreAtomic atomically sets this timestamp value. func (ts *MicroTS) StoreAtomic(newTS MicroTS) { atomic.StoreInt64((*int64)(ts), int64(newTS)) } // CompareAndSwapAtomic atomically sets the value of this timestamp value to newTS if its current value matches oldTS. // The return value indicates whether a swap happened. func (ts *MicroTS) CompareAndSwapAtomic(oldTS, newTS MicroTS) bool { return atomic.CompareAndSwapInt64((*int64)(ts), int64(oldTS), int64(newTS)) } // GoTime returns this microtimestamp as a `time.Time` object. func (ts MicroTS) GoTime() time.Time { return time.Unix(ts.UnixSeconds(), int64(ts.UnixNanosFraction())) } // UnixSeconds returns the number of seconds since Unix epoch represented by this microtimestamp. func (ts MicroTS) UnixSeconds() int64 { return int64(ts) / microsecondsPerSecond } // UnixNanos returns the number of nanoseconds since Unix epoch represented by this microtimestamp. func (ts MicroTS) UnixNanos() int64 { return int64(ts) * nanosecondsPerMicrosecond } // After returns whether the timestamp is after otherTS. func (ts MicroTS) After(otherTS MicroTS) bool { return ts > otherTS } // UnixNanosFraction returns the number of nanoseconds since the last full second. func (ts MicroTS) UnixNanosFraction() int32 { return int32(ts%microsecondsPerSecond) * nanosecondsPerMicrosecond } // Protobuf converts this microtimestamp to a (Google) protobuf representation. func (ts MicroTS) Protobuf() *timestamp.Timestamp { return &timestamp.Timestamp{ Seconds: ts.UnixSeconds(), Nanos: ts.UnixNanosFraction(), } } // GogoProtobuf converts this microtimestamp to a (Gogo) protobuf representation. func (ts MicroTS) GogoProtobuf() *types.Timestamp { return &types.Timestamp{ Seconds: ts.UnixSeconds(), Nanos: ts.UnixNanosFraction(), } } // ElapsedSince returns the time elapsed since the given timestamp, as a `time.Duration`. func (ts MicroTS) ElapsedSince(otherTS MicroTS) time.Duration { return time.Duration(ts-otherTS) * time.Microsecond } // Add adds the given `time.Duration` to this microtimestamp, and returns a new microtimestamp. func (ts MicroTS) Add(duration time.Duration) MicroTS { return ts + MicroTS(duration/time.Microsecond) } // FromGoTime converts the given `time.Time` object to a microtimestamp. func FromGoTime(t time.Time) MicroTS { return MicroTS(t.UnixNano() / nanosecondsPerMicrosecond) } // ProtoTimestamp is a common interface for timestamp protobuf objects (satisfied by both Google and Gogo protobuf // libraries). type ProtoTimestamp interface { GetSeconds() int64 GetNanos() int32 } // FromProtobuf converts the given protobuf timestamp message to a microtimestamp. func FromProtobuf(ts ProtoTimestamp) MicroTS { return MicroTS(ts.GetSeconds()*microsecondsPerSecond + int64(ts.GetNanos()/nanosecondsPerMicrosecond)) }
pkg/timestamp/microts.go
0.888698
0.449211
microts.go
starcoder
package playtak import ( "errors" "github.com/nelhage/taktician/tak" ) type FPARule interface { Greeting(tak.Color) []string LegalMove(p *tak.Position, m tak.Move) error GetMove(p *tak.Position) (tak.Move, bool) SurveyURL() string } type CenterBlack struct{} func (c *CenterBlack) Greeting(color tak.Color) []string { if color == tak.White { return nil } return []string{ "I'm an experiment bot testing alternate rules. " + "To play me, please place my first stone " + "in the center of the board."} } func (c *CenterBlack) LegalMove(p *tak.Position, m tak.Move) error { if p.MoveNumber() > 0 { return nil } if isCentered(p, m) { return nil } return errors.New("I'm testing rules to balance white's advantage. " + "To play me as white, you must place Black's first " + "piece in the center of the board.") } func (c *CenterBlack) GetMove(p *tak.Position) (tak.Move, bool) { if p.MoveNumber() > 0 { return tak.Move{}, false } return tak.Move{ X: int8(p.Size() / 2), Y: int8(p.Size() / 2), Type: tak.PlaceFlat, }, true } func (c *CenterBlack) SurveyURL() string { return "https://goo.gl/forms/k9SPmrxj11GZf7ak1" } func isCentered(p *tak.Position, m tak.Move) bool { mid := int8(p.Size() / 2) if p.Size()%2 == 1 { // Must be in exact center return m.X == mid && m.Y == mid } return (m.X == mid || m.X == mid-1) && (m.Y == mid || m.Y == mid-1) } type DoubleStack struct { blackPlace tak.Move blackTmp struct { x, y int } whitePlace tak.Move whiteTmp struct { x, y int } } func (d *DoubleStack) Greeting(tak.Color) []string { return []string{ "I'm an experimental bot testing alternate rules (Double Black Stack). " + "Black's very first stone will be a double stack instead of a normal piece. ", "Place the very first white and black stone normally. " + "Then, white should waste 2 moves moving back and forth. " + "Black should place a flat and stack on top of the original location. " + "Then, the game continues normally. ", "For an example opening, see https://goo.gl/RpLxhe", } } var doubleStackErrors = []string{ "", "", "As white, you needed to move your original piece 1 square, " + "wasting time so black can create a double stack " + "(Double Black Stack FPA experiment)", "As black, you needed to place a flat adjacent to your original piece, " + "so you can create a double stack next move. " + "(Double Black Stack FPA experiment)", "As white, you needed to move your original piece back to where it started, " + "wasting time so black can create a double stack " + "(Double Black Stack FPA experiment)", "As black, you needed to create a double stack on your original piece. " + "(Double Black Stack FPA experiment)", } func (d *DoubleStack) LegalMove(p *tak.Position, m tak.Move) error { ok := true switch p.MoveNumber() { case 0: // White places black anywhere d.blackPlace = m case 1: // Black places black anywhere d.whitePlace = m case 2: // White slides ok = m.IsSlide() ex, ey := m.Dest() d.whiteTmp.x, d.whiteTmp.y = int(ex), int(ey) case 3: // Black places adjacent to their first piece if m.Type != tak.PlaceFlat { ok = false break } dx := m.X - d.blackPlace.X dy := m.Y - d.blackPlace.Y if dx < 0 { dx = -dx } if dy < 0 { dy = -dy } ok = (dx == 1 && dy == 0) || (dx == 0 && dy == 1) d.blackTmp.x, d.blackTmp.y = int(m.X), int(m.Y) case 4: // White slides back if !m.IsSlide() { ok = false break } ex, ey := m.Dest() ok = (ex == d.whitePlace.X && ey == d.whitePlace.Y) case 5: // Black stacks if !m.IsSlide() { ok = false break } ex, ey := m.Dest() ok = (ex == d.blackPlace.X && ey == d.blackPlace.Y) default: } if ok { return nil } return errors.New(doubleStackErrors[p.MoveNumber()]) } func dir(x, y, ex, ey int) tak.MoveType { switch { case x < ex: return tak.SlideRight case x > ex: return tak.SlideLeft case y < ey: return tak.SlideUp case y > ey: return tak.SlideDown } panic("bad dir() call") } func adjacent(p *tak.Position, x, y int) (int, int) { switch { case x > 0 && p.Top(x-1, y) == 0: return x - 1, y case y > 0 && p.Top(x, y-1) == 0: return x, y - 1 case x+1 < p.Size() && p.Top(x+1, y) == 0: return x + 1, y case y+1 < p.Size() && p.Top(x, y+1) == 0: return x, y + 1 } panic("no empty adjacency") } func (d *DoubleStack) GetMove(p *tak.Position) (tak.Move, bool) { switch p.MoveNumber() { case 0, 1: return tak.Move{}, false case 2: // White slides x, y := int(d.whitePlace.X), int(d.whitePlace.Y) ex, ey := adjacent(p, x, y) m := tak.Move{ X: d.whitePlace.X, Y: d.whitePlace.Y, Type: dir(x, y, ex, ey), Slides: tak.MkSlides(1), } return m, true case 3: // Black places adjacent to their first piece x, y := int(d.blackPlace.X), int(d.blackPlace.Y) ex, ey := adjacent(p, x, y) m := tak.Move{ X: int8(ex), Y: int8(ey), Type: tak.PlaceFlat, } return m, true case 4: // White slides back m := tak.Move{ X: int8(d.whiteTmp.x), Y: int8(d.whiteTmp.y), Type: dir(d.whiteTmp.x, d.whiteTmp.y, int(d.whitePlace.X), int(d.whitePlace.Y)), Slides: tak.MkSlides(1), } return m, true case 5: // Black stacks m := tak.Move{ X: int8(d.blackTmp.x), Y: int8(d.blackTmp.y), Type: dir(d.blackTmp.x, d.blackTmp.y, int(d.blackPlace.X), int(d.blackPlace.Y)), Slides: tak.MkSlides(1), } return m, true default: return tak.Move{}, false } } func (d *DoubleStack) SurveyURL() string { return "https://goo.gl/forms/31clzCPiDAi9r59x1" } type Cairn struct { whitePlace tak.Move blackPlace tak.Move } func (c *Cairn) Greeting(tak.Color) []string { return []string{ "The US Tak Association uses a cairn (black on white stone) " + "for tiebreaker games.", "To create a cairn online, play the very first black " + "and white stones normally. Then, white must place " + "a stone adjacent to a center square, and black places " + "adjacent to a matching center square.", "Then, white moves so black can capture in the center, then " + "black captures, making the cairn. Then, the game continues normally.", } } var cairnErrors = []string{ "", "", "As white, you must place your stone adjacent to a center " + "square, so you can make a cairn with black.", "As black, you must place your stone adjacent to a center " + "square, so you can make a cairn with white.", "As white, you must move your stone to the center, so black " + "can capture it and make a cairn.", "As black, you must move your stone to capture white in the " + "center, making a cairn.", } func isCenterAdjacent(p *tak.Position, m tak.Move) bool { mid := int8(p.Size() / 2) if p.Size()%2 == 1 { return ((m.X == mid-1 || m.X == mid+1) && m.Y == mid) || ((m.Y == mid-1 || m.Y == mid+1) && m.X == mid) } if (m.X >= mid-1 && m.X <= mid) && (m.Y >= mid-2 || m.Y <= mid+1) { return true } if (m.X >= mid-2 && m.X <= mid+1) && (m.Y >= mid-1 || m.Y <= mid) { return true } return false } func distance(x1, y1, x2, y2 int8) int8 { dx := x1 - x2 if dx < 0 { dx = -dx } dy := y1 - y2 if dy < 0 { dy = -dy } return dx + dy } func (c *Cairn) LegalMove(p *tak.Position, m tak.Move) error { ok := true switch p.MoveNumber() { case 0, 1: break case 2: // white places adjacent to center if m.Type != tak.PlaceFlat { ok = false break } if !isCenterAdjacent(p, m) { ok = false } c.whitePlace = m break case 3: // black places adjacent to center if m.Type != tak.PlaceFlat { ok = false break } if !isCenterAdjacent(p, m) { ok = false } if distance(m.X, m.Y, c.whitePlace.X, c.whitePlace.Y) != 2 { ok = false } c.blackPlace = m case 4: // white slides to center, adjacent to black if !m.IsSlide() { ok = false break } dx, dy := m.Dest() dst := tak.Move{Type: tak.PlaceFlat, X: dx, Y: dy} if !isCentered(p, dst) { ok = false break } if distance(dx, dy, c.blackPlace.X, c.blackPlace.Y) != 1 { ok = false } c.whitePlace = dst case 5: // black captures if !m.IsSlide() { ok = false break } dx, dy := m.Dest() if m.X != c.blackPlace.X || m.Y != c.blackPlace.Y || dx != c.whitePlace.X || dy != c.whitePlace.Y { ok = false } default: } if ok { return nil } return errors.New(cairnErrors[p.MoveNumber()]) } func (c *Cairn) GetMove(p *tak.Position) (tak.Move, bool) { switch p.MoveNumber() { case 0, 1: return tak.Move{}, false case 2: // white places adjacent to center cx := int(p.Size()) / 2 cy := int(p.Size()) / 2 x, y := adjacent(p, cx, cy) m := tak.Move{ Type: tak.PlaceFlat, X: int8(x), Y: int8(y), } return m, true case 3: // black places adjacent to center wx := c.whitePlace.X wy := c.whitePlace.Y var x, y int8 if wx < int8(p.Size())/2 { x = wx + 1 } else { x = wx - 1 } if wy < int8(p.Size())/2 { y = wy + 1 } else { y = wy - 1 } return tak.Move{ Type: tak.PlaceFlat, X: x, Y: y, }, true case 4: // white slides to center wx := int(c.whitePlace.X) wy := int(c.whitePlace.Y) mid := int(p.Size() / 2) var ty tak.MoveType if p.Size()%2 == 1 { ty = dir(wx, wy, mid, mid) } else { if wx == mid || wy == mid { ty = dir(wx, wy, mid, mid) } else { ty = dir(wx, wy, mid-1, mid-1) } } return tak.Move{Type: ty, X: int8(wx), Y: int8(wy), Slides: tak.MkSlides(1)}, true case 5: return tak.Move{ Type: dir(int(c.blackPlace.X), int(c.blackPlace.Y), int(c.whitePlace.X), int(c.whitePlace.Y)), X: c.blackPlace.X, Y: c.blackPlace.Y, Slides: tak.MkSlides(1), }, true } return tak.Move{}, false } func (c *Cairn) SurveyURL() string { return "" }
cmd/internal/playtak/fpa.go
0.526586
0.412057
fpa.go
starcoder
package main import ( "encoding/json" "io" "io/ioutil" "log" "os" "path/filepath" "regexp" "time" ) /** * @info The generic data structure extended by other documentation structures * @property {string} [Name] The Name of the structure * @property {string} [Type] The type of the structure * @property {string} [Description] The Description of the structure */ type Data struct { Name string `json:"Name,omitempty"` Type string `json:"Type,omitempty"` Description string `json:"Description,omitempty"` } /** * @info The function data structure used for functions * @property {string} [Name] The Name of the function * @property {string} [Description] The Description of the function * @property {[]Data} [Parameters] The Parameters of the function * @property {Data} [Returns] The Return value of the function */ type FunctionData struct { Name string `json:"Name,omitempty"` Line string `json:"Line,omitempty"` Description string `json:"Description,omitempty"` Example string `json:"Example,omitempty"` Parameters []Data `json:"Parameters,omitempty"` Returns Data `json:"Returns,omitempty"` } /** * @info The structure data structure used for structures * @property {string} [Name] The Name of the structure * @property {string} [Description] The Description of the structure * @property {[]Data} [Properties] The properties of the structure */ type StructureData struct { Name string `json:"Name,omitempty"` Line string `json:"Line,omitempty"` Description string `json:"Description,omitempty"` Functions []FunctionData `json:"Functions,omitempty"` Properties []Data `json:"Properties,omitempty"` } /** * @info The general meta information of the documentation * @property {string} [Generator] The Name of the structure * @property {string} [Format] The Description of the structure * @property {string} [Date] The properties of the structure */ type Meta struct { Generator string `json:"Generator,omitempty"` Format string `json:"Format,omitempty"` Date string `json:"Date,omitempty"` } /** * @info The DocgenData used to make the docs JSON * @property {Meta} [Meta] The general meta information of the documentation * @property {[]FunctionData} [Functions] The Functions of the project * @property {[]StructureData} [Date] The Structures of the project */ type DocgenData struct { Meta Meta Functions []FunctionData `json:"Functions,omitempty"` Structures []StructureData `json:"Structures,omitempty"` } var DocsMatcher = regexp.MustCompile(`\/\*[\s\S]*?\*\/[\r\n]+([^\r\n]+)`) /** * @info Get all files ending in .go from a directory, recursively * @param {string} [root] The root directory */ func GetFiles(root string) ([]string, error) { var files []string err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { if !info.IsDir() && EndsWith(info.Name(), "go") { files = append(files, path) } return nil }) return files, err } /** * @info Parse the description of a comment * @param {string} [data] The comment to parse */ func ParseDescription(data string) string { description := Trim(Remove(data, "* @info")) return description } /** * @info Parse the parameter of a function comment * @param {string} [data] The comment to parse */ func ParseParam(data string) Data { data = Trim(Remove(data, "* @param")) Type, data := GetType(data) Name, data := GetName(data) Description := Trim(data) return Data{Name: Name, Type: Type, Description: Description} } /** * @info Parse the property of a structure comment * @param {string} [data] The comment to parse */ func ParseProperty(data string) Data { data = Remove(data, "* @property") Type, data := GetType(data) Name, data := GetName(data) Description := Trim(data) return Data{Name: Name, Type: Type, Description: Description} } /** * @info Parse the return value of a return comment * @param {string} [data] The comment to parse */ func ParseReturn(data string) Data { data = Remove(data, "* @returns") Type, data := GetType(data) Description := Trim(data) return Data{Type: Type, Description: Description} } /** * @info Parse a single line of a structure comment * @param {string} [line] The comment to parse * @param {StructureData} [StructureDocs] The Structure Docs for adding data */ func ParseStructure(line string, StructureDocs StructureData) StructureData { line = Trim(line) if IsStructureLine(line) { StructureDocs.Line = Trim(Remove(line, "{")) array := Split(StructureDocs.Line, " ") for _, word := range array { if IsStructureLine(word) { continue } StructureDocs.Name = word break } } if StartsWith(line, "* @info") { StructureDocs.Description = ParseDescription(line) } if StartsWith(line, "* @property") { parsed := ParseProperty(line) StructureDocs.Properties = append(StructureDocs.Properties, parsed) } return StructureDocs } /** * @info Parse name of a function * @param {string} [line] The line of comment * @param {FunctionData} [FunctionDocs] The Function Docs for adding data */ func ParseFunctionName(line string, FunctionDocs FunctionData) FunctionData { array := Split(FunctionDocs.Line, " ") for _, word := range array { if IsFunctionLine(word) { continue } if EndsWith(word, "()") { FunctionDocs.Name = Remove(word, "()") break } if StartsWith(word, "(") || EndsWith(word, ")") { continue } FunctionDocs.Name = Split(word, "(")[0] break } return FunctionDocs } /** * @info Parse a single line of a function comment * @param {string} [line] The line of comment * @param {FunctionData} [FunctionDocs] The Function Docs for adding data */ func ParseFunction(line string, FunctionDocs FunctionData) (FunctionData, string) { line, name := Trim(line), "" FunctionDocs.Line = Trim(Remove(line, "{")) if IsFunctionOfStructureLine(line) { FunctionDocs = ParseFunctionName(FunctionDocs.Line, FunctionDocs) name = Remove(Remove(Split(FunctionDocs.Line, " ")[2], "*"), ")") } else if IsFunctionLine(line) { FunctionDocs = ParseFunctionName(FunctionDocs.Line, FunctionDocs) } if StartsWith(line, "* @info") { FunctionDocs.Description = ParseDescription(line) } if StartsWith(line, "* @param") { parsed := ParseParam(line) FunctionDocs.Parameters = append(FunctionDocs.Parameters, parsed) } if StartsWith(line, "* @returns") { parsed := ParseReturn(line) FunctionDocs.Returns = parsed } return FunctionDocs, name } func main() { DocJson := DocgenData{Meta: Meta{Generator: "1", Format: "1", Date: time.Now().String()}} args := "." outFile := "output.json" if len(os.Args) > 1 { args = os.Args[1] } if len(os.Args) > 2 { outFile = os.Args[2] } files, err := GetFiles(args) if err != nil { log.Fatal(err) } if len(args) > 0 { for _, file := range files { data, err := os.Open(file) if err != nil { log.Fatal(err) } defer data.Close() output, err := io.ReadAll(data) if err != nil { log.Fatal(err) } content := string(output) matches := DocsMatcher.FindAllString(content, -1) for _, data := range matches { lines := Split(data, "\n") if IsFunction(data) { parsed, name := FunctionData{}, "" for _, line := range lines { parsed, name = ParseFunction(line, parsed) } if name != "" { for i := range DocJson.Structures { if DocJson.Structures[i].Name == name { DocJson.Structures[i].Functions = append(DocJson.Structures[i].Functions, parsed) } } continue } DocJson.Functions = append(DocJson.Functions, parsed) } else if IsStructure(data) { parsed := StructureData{} for _, line := range lines { parsed = ParseStructure(line, parsed) } DocJson.Structures = append(DocJson.Structures, parsed) } } file, _ := json.MarshalIndent(DocJson, "", "\t") _ = ioutil.WriteFile(outFile, file, 0644) } } }
docgen.go
0.696578
0.47524
docgen.go
starcoder
package core import ( "encoding/json" "errors" ) // FeatureOfInterest in SensorThings represents the phenomena an Observation is detecting. In some cases a FeatureOfInterest // can be the Location of the Sensor and therefore of the Observation. A FeatureOfInterest is linked to a single Observation type FeatureOfInterest struct { BaseEntity Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` EncodingType string `json:"encodingType,omitempty"` Feature map[string]interface{} `json:"feature,omitempty"` NavObservations string `json:"<EMAIL>,omitempty"` Observations []*Observation `json:"Observations,omitempty"` OriginalLocationID interface{} `json:"-"` } func (f *FeatureOfInterest) ClearNav() { f.NavSelf = "" f.NavObservations = "" } // GetEntityType returns the EntityType for FeatureOfInterest func (f FeatureOfInterest) GetEntityType() EntityType { return EntityTypeFeatureOfInterest } // GetPropertyNames returns the available properties for a FeatureOfInterest func (f *FeatureOfInterest) GetPropertyNames() []string { return []string{"id", "name", "description", "encodingType", "feature"} } // ParseEntity tries to parse the given json byte array into the current entity func (f *FeatureOfInterest) ParseEntity(data []byte) error { foi := &f err := json.Unmarshal(data, foi) if err != nil { return errors.New("Unable to parse FeatureOfInterest") } return nil } // ContainsMandatoryParams checks if all mandatory params for a FeatureOfInterest are available before posting func (f *FeatureOfInterest) ContainsMandatoryParams() (bool, []error) { err := []error{} CheckMandatoryParam(&err, f.Name, f.GetEntityType(), "name") CheckMandatoryParam(&err, f.Description, f.GetEntityType(), "description") CheckMandatoryParam(&err, f.EncodingType, f.GetEntityType(), "encodingType") CheckMandatoryParam(&err, f.Feature, f.GetEntityType(), "feature") if len(err) != 0 { return false, err } return true, nil } // SetAllLinks sets the self link and relational links func (f *FeatureOfInterest) SetAllLinks(externalURL string) { f.SetSelfLink(externalURL) f.SetLinks(externalURL) for _, o := range f.Observations { o.SetAllLinks(externalURL) } } // SetSelfLink sets the self link for the entity func (f *FeatureOfInterest) SetSelfLink(externalURL string) { f.NavSelf = CreateEntitySelfLink(externalURL, EntityLinkFeatureOfInterests.ToString(), f.ID) } // SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil func (f *FeatureOfInterest) SetLinks(externalURL string) { f.NavObservations = CreateEntityLink(f.Observations == nil, externalURL, EntityLinkFeatureOfInterests.ToString(), EntityLinkObservations.ToString(), f.ID) }
featureofinterest.go
0.786623
0.437283
featureofinterest.go
starcoder
package jwt import ( "encoding/json" "reflect" "time" ) // TimePrecision determines how precisely time is measured // by this library. When serializing and deserialzing tokens, // time values are automatically truncated to this precision. // See the time package's Truncate method for more detail const TimePrecision = time.Microsecond // Time is how this library represents time values. It's mostly // a wrapper for the standard library's time.Time, but adds // specialized JSON decoding behavior to interop with the way // time is represented by JWT. Also makes it possible to represent // nil values. type Time struct { time.Time } // NewTime creates a new Time value from a float64, following // the JWT spec. func NewTime(t float64) *Time { return At(time.Unix(0, int64(t*float64(time.Second)))) } // Now returns a new Time value using the current time. // You can override Now by changing the value of TimeFunc func Now() *Time { return At(TimeFunc()) } // At makes a Time value from a standard library time.Time value func At(at time.Time) *Time { return &Time{at.Truncate(TimePrecision)} } // ParseTime is used for creating a Time value from various // possible representations that can occur in serialization. func ParseTime(value interface{}) (*Time, error) { switch v := value.(type) { case int64: return NewTime(float64(v)), nil case float64: return NewTime(v), nil case json.Number: vv, err := v.Float64() if err != nil { return nil, err } return NewTime(vv), nil case nil: return nil, nil default: return nil, &json.UnsupportedTypeError{Type: reflect.TypeOf(v)} } } // UnmarshalJSON implements the json package's Unmarshaler interface func (t *Time) UnmarshalJSON(data []byte) error { var value json.Number err := json.Unmarshal(data, &value) if err != nil { return err } v, err := ParseTime(value) *t = *v return err } // MarshalJSON implements the json package's Marshaler interface func (t *Time) MarshalJSON() ([]byte, error) { f := float64(t.Truncate(TimePrecision).UnixNano()) / float64(time.Second) return json.Marshal(f) }
vendor/github.com/dgrijalva/jwt-go/v4/time.go
0.853303
0.403214
time.go
starcoder
package input var Example = []string{ "light red bags contain 1 bright white bag, 2 muted yellow bags.", "dark orange bags contain 3 bright white bags, 4 muted yellow bags.", "bright white bags contain 1 shiny gold bag.", "muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.", "shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags.", "dark olive bags contain 3 faded blue bags, 4 dotted black bags.", "vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.", "faded blue bags contain no other bags.", "dotted black bags contain no other bags.", } var Example2 = []string{ "shiny gold bags contain 2 dark red bags.", "dark red bags contain 2 dark orange bags.", "dark orange bags contain 2 dark yellow bags.", "dark yellow bags contain 2 dark green bags.", "dark green bags contain 2 dark blue bags.", "dark blue bags contain 2 dark violet bags.", "dark violet bags contain no other bags.", } var Input = []string{ "drab tan bags contain 4 clear gold bags.", "vibrant lime bags contain 3 faded gold bags, 3 plaid aqua bags, 2 clear black bags.", "pale lime bags contain 1 dim salmon bag, 5 faded salmon bags, 1 dim turquoise bag.", "dull gray bags contain 1 striped gold bag, 1 vibrant yellow bag.", "light fuchsia bags contain 4 light lavender bags, 5 faded olive bags, 4 plaid cyan bags, 1 striped tomato bag.", "drab gold bags contain 1 clear teal bag.", "dim red bags contain 2 dull teal bags.", "striped orange bags contain 1 bright fuchsia bag, 3 plaid chartreuse bags, 4 dark silver bags, 5 dim maroon bags.", "shiny violet bags contain 1 clear orange bag, 4 muted olive bags, 4 dark chartreuse bags, 4 shiny indigo bags.", "faded olive bags contain 2 dotted silver bags, 4 clear gray bags.", "dotted lime bags contain 1 dark turquoise bag, 1 striped orange bag, 2 shiny teal bags, 2 vibrant cyan bags.", "drab magenta bags contain 4 bright yellow bags, 5 dull orange bags, 5 plaid tomato bags.", "dull black bags contain 4 light olive bags.", "posh turquoise bags contain 1 muted salmon bag, 1 muted black bag, 5 shiny turquoise bags.", "muted purple bags contain 5 dotted red bags.", "striped black bags contain 1 striped fuchsia bag, 4 drab indigo bags, 3 dark turquoise bags.", "drab brown bags contain 3 clear gray bags, 1 light gray bag, 1 dull coral bag.", "pale purple bags contain 5 mirrored black bags, 4 wavy crimson bags.", "dark turquoise bags contain 1 dotted violet bag.", "clear lavender bags contain 1 light olive bag, 4 wavy yellow bags, 4 plaid red bags, 2 faded salmon bags.", "bright coral bags contain 2 bright brown bags.", "posh coral bags contain 4 dull teal bags, 4 bright aqua bags.", "drab lime bags contain 4 striped tan bags, 4 muted violet bags.", "striped brown bags contain 1 dark lime bag, 4 clear orange bags.", "wavy bronze bags contain 2 posh coral bags, 3 mirrored silver bags.", "dim black bags contain 1 dark maroon bag, 4 muted lavender bags, 3 bright cyan bags, 3 dark plum bags.", "posh yellow bags contain 4 dull plum bags, 5 shiny blue bags, 3 plaid tomato bags.", "pale violet bags contain 1 plaid red bag, 2 posh fuchsia bags.", "mirrored bronze bags contain 4 striped lavender bags.", "vibrant silver bags contain 4 posh brown bags, 4 clear indigo bags, 4 dotted silver bags, 5 drab lavender bags.", "dark brown bags contain 1 mirrored plum bag, 1 muted violet bag, 3 muted tomato bags.", "wavy green bags contain 2 posh bronze bags, 3 dull purple bags, 1 wavy red bag.", "light beige bags contain 3 light maroon bags, 3 vibrant orange bags, 4 clear blue bags, 3 mirrored fuchsia bags.", "wavy crimson bags contain 5 muted beige bags, 2 dark olive bags.", "clear tan bags contain 1 wavy yellow bag.", "posh lime bags contain 3 wavy beige bags.", "pale blue bags contain 5 dull aqua bags, 4 pale crimson bags, 4 clear indigo bags, 3 dull lime bags.", "wavy silver bags contain 1 pale cyan bag.", "striped beige bags contain 4 dim plum bags, 1 clear gray bag.", "dim gold bags contain 3 dull cyan bags, 3 drab black bags, 4 dark green bags.", "vibrant teal bags contain 5 clear green bags, 4 light violet bags, 2 bright beige bags.", "light tan bags contain 5 pale red bags, 3 light turquoise bags, 2 mirrored chartreuse bags.", "dark red bags contain 5 shiny lime bags, 3 clear blue bags, 1 posh black bag.", "posh salmon bags contain 1 vibrant silver bag, 1 plaid salmon bag, 5 dark turquoise bags, 1 shiny orange bag.", "mirrored yellow bags contain 5 posh gray bags, 1 shiny silver bag, 1 dark brown bag.", "dark fuchsia bags contain 1 plaid plum bag.", "bright bronze bags contain 4 dark turquoise bags.", "posh silver bags contain 1 muted gold bag, 3 dull aqua bags, 2 striped chartreuse bags, 3 posh gray bags.", "dotted salmon bags contain 2 vibrant bronze bags, 3 striped blue bags, 4 striped fuchsia bags.", "dark orange bags contain 5 faded magenta bags.", "bright silver bags contain 5 drab silver bags.", "posh orange bags contain 4 plaid tan bags, 5 light tan bags.", "mirrored olive bags contain 4 dull cyan bags, 4 posh black bags, 2 striped chartreuse bags.", "drab beige bags contain 2 dark green bags, 2 bright maroon bags.", "muted bronze bags contain 2 clear indigo bags, 1 clear green bag.", "dark lime bags contain 3 wavy brown bags.", "dark olive bags contain 4 muted gold bags, 1 shiny chartreuse bag.", "dull white bags contain 2 muted crimson bags, 1 light maroon bag.", "shiny gray bags contain 1 striped orange bag, 2 dim maroon bags.", "dotted orange bags contain 1 dull teal bag, 1 light salmon bag, 4 shiny brown bags, 4 muted salmon bags.", "clear olive bags contain 3 mirrored tan bags, 5 pale tan bags.", "drab bronze bags contain 1 drab teal bag, 1 dark green bag.", "drab chartreuse bags contain 4 dim beige bags.", "faded cyan bags contain 5 clear gold bags.", "plaid fuchsia bags contain 2 pale yellow bags.", "light gold bags contain 5 pale cyan bags, 1 posh olive bag, 2 faded salmon bags, 5 pale tomato bags.", "pale bronze bags contain 2 posh white bags.", "shiny coral bags contain 2 plaid crimson bags, 1 clear turquoise bag.", "vibrant green bags contain 4 shiny gold bags, 2 dim orange bags, 3 plaid chartreuse bags, 4 dark tomato bags.", "vibrant violet bags contain 5 bright aqua bags, 5 clear purple bags.", "muted fuchsia bags contain 2 bright yellow bags.", "bright olive bags contain 5 bright gold bags, 5 plaid aqua bags, 5 dull black bags, 1 mirrored indigo bag.", "mirrored maroon bags contain 2 dull chartreuse bags.", "pale salmon bags contain 1 muted gold bag, 5 bright red bags, 5 mirrored tan bags, 1 muted salmon bag.", "faded brown bags contain 3 plaid tomato bags, 2 muted olive bags, 5 dull orange bags, 2 dark silver bags.", "dark lavender bags contain 4 dark tomato bags, 2 drab plum bags, 3 vibrant gray bags, 1 dim gold bag.", "plaid coral bags contain 3 striped turquoise bags, 2 faded salmon bags.", "drab black bags contain 1 vibrant black bag.", "shiny black bags contain 3 posh gray bags, 3 shiny olive bags, 4 dull violet bags, 4 vibrant plum bags.", "muted plum bags contain 4 dull violet bags, 5 pale tomato bags, 1 shiny brown bag, 1 dark plum bag.", "shiny lavender bags contain 4 mirrored lavender bags.", "mirrored blue bags contain 1 faded violet bag, 2 plaid olive bags.", "dotted aqua bags contain 3 shiny yellow bags.", "light lavender bags contain 2 bright maroon bags, 4 shiny lime bags, 3 dark maroon bags, 1 light silver bag.", "bright orange bags contain 3 striped gold bags, 5 dotted violet bags.", "muted tomato bags contain 5 clear blue bags, 5 mirrored fuchsia bags.", "dim indigo bags contain 1 pale olive bag, 1 light indigo bag, 5 posh brown bags.", "faded turquoise bags contain 3 pale chartreuse bags, 4 light olive bags.", "wavy teal bags contain 3 clear brown bags, 3 dark beige bags.", "dotted bronze bags contain 1 wavy brown bag.", "posh purple bags contain 5 bright maroon bags, 1 clear silver bag, 2 shiny indigo bags.", "dull violet bags contain 1 vibrant black bag.", "drab indigo bags contain 4 light beige bags.", "mirrored crimson bags contain 4 plaid bronze bags, 3 pale chartreuse bags, 2 mirrored olive bags, 4 muted lavender bags.", "mirrored tan bags contain 2 posh brown bags, 3 dark red bags, 3 faded salmon bags.", "wavy fuchsia bags contain 2 pale crimson bags, 1 plaid magenta bag, 2 drab plum bags, 1 drab aqua bag.", "striped yellow bags contain 4 dark coral bags, 5 dim silver bags.", "striped white bags contain 4 faded teal bags, 2 posh black bags, 3 vibrant yellow bags, 1 faded yellow bag.", "light turquoise bags contain 4 dark red bags, 5 posh white bags, 1 vibrant bronze bag.", "clear blue bags contain no other bags.", "faded blue bags contain 5 clear indigo bags, 4 muted salmon bags, 3 bright violet bags, 4 dark purple bags.", "dim aqua bags contain 4 posh gray bags, 1 clear bronze bag, 4 dull magenta bags, 5 plaid red bags.", "shiny magenta bags contain 2 mirrored teal bags.", "wavy maroon bags contain 1 dull cyan bag, 2 striped yellow bags, 2 light turquoise bags.", "plaid teal bags contain 5 light olive bags, 2 vibrant green bags, 4 plaid yellow bags.", "bright tomato bags contain 3 bright maroon bags, 3 clear blue bags, 5 posh lavender bags, 5 shiny lime bags.", "mirrored lavender bags contain 5 striped bronze bags, 4 drab plum bags, 1 faded violet bag, 5 bright maroon bags.", "vibrant purple bags contain 1 dull plum bag, 4 wavy yellow bags.", "posh aqua bags contain 2 plaid teal bags, 3 pale tomato bags, 4 muted teal bags.", "faded fuchsia bags contain 3 dark lavender bags, 4 plaid green bags, 5 drab gold bags.", "dim silver bags contain 1 vibrant yellow bag, 1 clear tomato bag.", "bright brown bags contain 3 striped white bags, 4 shiny orange bags.", "dim olive bags contain 2 clear violet bags, 3 plaid gold bags, 3 plaid lime bags, 4 dim plum bags.", "striped teal bags contain 2 bright lavender bags, 5 faded beige bags, 5 clear beige bags, 4 dotted turquoise bags.", "posh plum bags contain 3 bright brown bags.", "faded teal bags contain 4 bright aqua bags, 2 bright red bags, 2 dotted beige bags, 5 shiny teal bags.", "striped indigo bags contain 5 clear cyan bags, 3 clear gray bags, 4 plaid olive bags, 3 plaid lime bags.", "drab blue bags contain 2 dim coral bags, 4 plaid purple bags.", "light olive bags contain 1 clear purple bag, 4 clear blue bags.", "vibrant red bags contain 2 bright red bags, 2 pale gray bags, 4 wavy tomato bags.", "faded salmon bags contain 5 posh brown bags.", "shiny brown bags contain 2 dull green bags, 3 wavy lime bags.", "posh olive bags contain 5 mirrored lavender bags, 3 clear gray bags.", "clear green bags contain 2 faded aqua bags, 3 vibrant olive bags, 4 dim orange bags.", "mirrored violet bags contain 5 wavy lime bags, 1 wavy chartreuse bag.", "light brown bags contain 5 dark lavender bags.", "plaid blue bags contain 3 plaid beige bags, 5 dotted teal bags.", "dim green bags contain 1 light gray bag, 5 bright green bags.", "mirrored plum bags contain 1 dark turquoise bag, 1 plaid black bag.", "dotted turquoise bags contain 1 clear purple bag, 2 bright fuchsia bags.", "dull salmon bags contain 3 faded lime bags, 1 striped gray bag, 3 dull gold bags.", "wavy plum bags contain 4 shiny green bags, 3 pale tomato bags, 2 dull crimson bags.", "bright blue bags contain 5 dull lavender bags, 5 drab black bags.", "posh tomato bags contain 4 clear turquoise bags, 2 dim chartreuse bags, 4 bright aqua bags.", "dotted lavender bags contain 4 wavy red bags.", "posh magenta bags contain 3 light olive bags.", "faded beige bags contain 5 muted olive bags, 4 bright maroon bags, 1 bright fuchsia bag.", "vibrant plum bags contain 4 plaid crimson bags, 3 faded turquoise bags.", "pale green bags contain 3 wavy tomato bags, 4 plaid indigo bags, 3 pale crimson bags.", "dull fuchsia bags contain 2 clear gold bags.", "light plum bags contain 5 dark plum bags, 1 striped white bag.", "dotted olive bags contain 5 vibrant maroon bags.", "striped gold bags contain 1 dull lime bag, 3 clear blue bags, 5 vibrant cyan bags.", "bright violet bags contain 1 shiny lime bag, 1 muted tomato bag.", "dim yellow bags contain 2 dull green bags.", "bright indigo bags contain 4 light salmon bags, 3 wavy lavender bags, 3 light gold bags, 4 plaid olive bags.", "plaid lime bags contain 5 plaid crimson bags, 5 dark bronze bags.", "striped aqua bags contain 5 dark olive bags, 4 dull tomato bags, 5 pale gold bags, 1 dark silver bag.", "dull maroon bags contain 2 pale teal bags, 5 light coral bags, 4 light magenta bags.", "muted tan bags contain 2 clear yellow bags, 4 plaid indigo bags, 2 dotted crimson bags, 2 dim plum bags.", "plaid tan bags contain 1 wavy beige bag, 4 dark chartreuse bags.", "dull beige bags contain 3 posh cyan bags, 3 posh yellow bags, 4 wavy green bags, 1 striped brown bag.", "posh cyan bags contain 1 faded yellow bag, 5 dark coral bags.", "drab red bags contain 2 wavy lime bags, 2 posh brown bags.", "drab gray bags contain 1 mirrored yellow bag, 2 plaid turquoise bags.", "muted red bags contain 1 shiny silver bag, 2 pale coral bags, 5 dull plum bags.", "drab green bags contain 4 shiny brown bags, 3 striped yellow bags, 5 clear blue bags.", "dim gray bags contain 5 wavy maroon bags, 3 light tomato bags, 1 dim plum bag.", "dark white bags contain 3 light brown bags.", "posh black bags contain no other bags.", "dim turquoise bags contain 3 dull fuchsia bags, 2 dull black bags.", "drab lavender bags contain 3 pale maroon bags.", "striped crimson bags contain 5 light coral bags.", "vibrant olive bags contain 4 vibrant gold bags.", "dim maroon bags contain 4 drab red bags, 3 pale salmon bags, 1 mirrored fuchsia bag, 3 dim coral bags.", "muted lime bags contain 4 drab cyan bags, 1 muted beige bag.", "drab purple bags contain 4 dotted gold bags.", "muted beige bags contain 1 vibrant violet bag, 2 light lavender bags, 4 wavy maroon bags.", "dotted green bags contain 1 wavy blue bag.", "bright black bags contain 4 wavy chartreuse bags, 1 clear purple bag.", "wavy yellow bags contain 2 posh lavender bags, 5 faded yellow bags.", "faded yellow bags contain 4 posh black bags, 2 bright chartreuse bags, 5 bright fuchsia bags.", "dim purple bags contain 2 faded lavender bags, 3 bright aqua bags, 4 mirrored fuchsia bags, 5 posh tomato bags.", "bright chartreuse bags contain no other bags.", "vibrant maroon bags contain 1 clear gold bag, 3 bright purple bags.", "pale fuchsia bags contain 2 dark magenta bags.", "dotted teal bags contain 5 shiny chartreuse bags.", "dull lime bags contain 2 dotted violet bags, 3 vibrant cyan bags.", "bright salmon bags contain 2 vibrant coral bags, 3 bright gray bags, 4 wavy beige bags, 1 faded green bag.", "bright magenta bags contain 3 vibrant crimson bags, 1 striped fuchsia bag, 1 mirrored maroon bag.", "striped red bags contain 4 vibrant indigo bags, 3 plaid black bags, 3 dark coral bags.", "pale teal bags contain 3 shiny purple bags, 3 light turquoise bags, 5 bright aqua bags, 4 clear blue bags.", "clear cyan bags contain 3 bright maroon bags, 3 shiny purple bags, 1 dark green bag, 5 muted olive bags.", "muted gray bags contain 4 dark teal bags, 3 vibrant coral bags, 4 plaid red bags.", "bright gold bags contain 2 faded indigo bags, 1 muted beige bag, 5 mirrored orange bags, 4 pale green bags.", "clear red bags contain 3 plaid tomato bags, 2 dark violet bags.", "striped purple bags contain 3 posh lavender bags.", "plaid violet bags contain 5 mirrored gold bags.", "shiny crimson bags contain 4 bright black bags, 2 wavy purple bags, 1 dark crimson bag.", "posh gold bags contain 4 dull yellow bags.", "dim crimson bags contain 3 drab white bags.", "posh red bags contain 3 dull green bags, 1 striped red bag.", "drab turquoise bags contain 5 clear beige bags, 3 dull orange bags, 3 shiny green bags, 5 dark yellow bags.", "vibrant cyan bags contain no other bags.", "light bronze bags contain 3 plaid magenta bags, 2 pale salmon bags, 1 dim orange bag, 2 vibrant blue bags.", "dotted cyan bags contain 1 faded purple bag, 4 drab crimson bags.", "drab fuchsia bags contain 4 plaid salmon bags.", "clear maroon bags contain 4 dotted white bags, 1 dark olive bag, 1 dull red bag.", "dim salmon bags contain 4 light green bags, 2 drab black bags, 4 drab lime bags.", "wavy aqua bags contain 5 dull tan bags, 4 plaid crimson bags.", "pale beige bags contain 2 faded lavender bags, 5 striped beige bags, 1 light teal bag.", "dark maroon bags contain 2 bright tomato bags, 2 striped chartreuse bags, 5 bright maroon bags.", "light aqua bags contain 3 faded yellow bags.", "dim tan bags contain 5 light orange bags, 5 dark white bags, 1 dull green bag.", "vibrant brown bags contain 2 plaid tomato bags.", "light magenta bags contain 5 dotted violet bags, 2 faded crimson bags, 3 bright red bags, 5 mirrored turquoise bags.", "clear turquoise bags contain 3 striped tan bags, 2 mirrored tan bags, 4 plaid black bags.", "dull crimson bags contain 2 faded tomato bags, 4 dotted beige bags, 5 dim coral bags, 3 shiny coral bags.", "dull orange bags contain 5 muted tomato bags, 5 dull lime bags, 4 faded salmon bags, 5 bright chartreuse bags.", "wavy black bags contain 3 dark cyan bags, 3 clear red bags.", "plaid olive bags contain 1 mirrored fuchsia bag, 5 dull purple bags, 1 bright fuchsia bag.", "plaid indigo bags contain 3 mirrored tan bags, 1 mirrored olive bag, 1 striped turquoise bag, 1 dotted violet bag.", "dim brown bags contain 4 faded teal bags.", "muted indigo bags contain 1 mirrored plum bag, 5 pale gray bags, 5 faded salmon bags.", "dull plum bags contain 4 mirrored cyan bags, 2 light coral bags, 3 dark violet bags, 4 striped fuchsia bags.", "vibrant tan bags contain 2 clear white bags, 1 dim silver bag.", "plaid tomato bags contain 3 dark green bags.", "shiny white bags contain 1 dotted bronze bag, 2 faded gold bags, 1 drab tan bag.", "plaid red bags contain 2 pale olive bags, 2 muted purple bags, 3 mirrored chartreuse bags.", "drab orange bags contain 3 bright indigo bags, 3 pale salmon bags.", "striped green bags contain 4 pale maroon bags, 4 muted brown bags, 2 bright tomato bags.", "shiny indigo bags contain 4 clear teal bags, 1 pale teal bag, 4 vibrant purple bags, 3 plaid brown bags.", "drab yellow bags contain 5 faded black bags, 1 plaid green bag, 1 mirrored plum bag.", "faded magenta bags contain 4 vibrant indigo bags, 2 shiny gold bags, 2 mirrored lavender bags.", "muted yellow bags contain 4 light turquoise bags, 2 shiny lime bags, 2 striped white bags, 3 dark silver bags.", "posh brown bags contain 3 dull cyan bags.", "pale tomato bags contain 1 mirrored fuchsia bag.", "dark aqua bags contain 4 dull blue bags, 5 mirrored white bags.", "muted blue bags contain 3 mirrored fuchsia bags.", "light silver bags contain no other bags.", "muted coral bags contain 1 pale plum bag, 2 wavy crimson bags, 5 posh magenta bags, 4 vibrant brown bags.", "muted green bags contain 4 shiny gray bags, 4 pale crimson bags, 4 striped yellow bags, 1 bright salmon bag.", "muted brown bags contain 2 dark lavender bags, 2 dim chartreuse bags.", "dim violet bags contain 4 faded tan bags, 3 dull violet bags, 1 light yellow bag.", "clear fuchsia bags contain 2 drab plum bags.", "muted violet bags contain 3 muted salmon bags, 1 clear tomato bag, 1 dark red bag.", "posh violet bags contain 5 dull chartreuse bags, 2 light coral bags, 5 mirrored cyan bags.", "dark violet bags contain 1 vibrant bronze bag, 4 bright red bags, 3 striped gold bags.", "dotted fuchsia bags contain 2 vibrant tan bags, 5 striped crimson bags, 3 wavy silver bags.", "vibrant indigo bags contain 3 bright fuchsia bags, 2 muted gold bags, 1 bright red bag, 3 bright aqua bags.", "vibrant gray bags contain 3 vibrant yellow bags, 2 clear teal bags.", "dotted plum bags contain 5 dull crimson bags, 2 posh green bags, 2 light gray bags, 2 pale tomato bags.", "vibrant magenta bags contain 4 dotted beige bags.", "drab maroon bags contain 1 drab coral bag, 1 dotted tan bag, 1 dull cyan bag.", "dotted gold bags contain 1 wavy yellow bag, 4 dark olive bags.", "striped cyan bags contain 4 shiny gold bags, 5 striped crimson bags, 5 striped red bags.", "pale silver bags contain 5 vibrant red bags, 4 clear red bags.", "drab coral bags contain 4 striped gold bags, 5 striped silver bags, 4 mirrored turquoise bags, 5 striped turquoise bags.", "vibrant chartreuse bags contain 5 striped gray bags, 1 bright turquoise bag, 1 shiny silver bag.", "pale maroon bags contain 5 vibrant bronze bags, 4 bright tan bags, 2 clear gray bags, 4 light turquoise bags.", "wavy blue bags contain 4 wavy yellow bags.", "mirrored green bags contain 4 dark red bags, 1 striped white bag, 3 faded beige bags, 5 wavy red bags.", "shiny purple bags contain 1 clear blue bag, 4 striped chartreuse bags, 5 dark maroon bags.", "dim white bags contain 3 striped gold bags, 4 striped beige bags, 2 muted blue bags, 4 muted white bags.", "posh maroon bags contain 2 dotted red bags, 5 dotted crimson bags.", "posh chartreuse bags contain 4 shiny turquoise bags, 5 posh gray bags, 2 mirrored blue bags, 5 light maroon bags.", "dim orange bags contain 1 faded beige bag.", "clear gray bags contain 1 bright red bag, 2 dull cyan bags, 3 bright maroon bags, 3 muted gold bags.", "dull purple bags contain 4 muted gold bags, 2 faded beige bags.", "muted olive bags contain 4 clear blue bags, 1 posh lavender bag, 1 posh brown bag, 2 striped chartreuse bags.", "pale lavender bags contain 1 dull gray bag, 3 posh silver bags, 3 dark aqua bags.", "shiny blue bags contain 5 bright tan bags, 4 faded yellow bags.", "plaid salmon bags contain 3 shiny teal bags.", "mirrored silver bags contain 4 plaid tomato bags, 5 dotted salmon bags.", "light blue bags contain 3 pale tan bags, 2 mirrored fuchsia bags, 4 drab maroon bags, 1 posh silver bag.", "light orange bags contain 2 dark gold bags, 1 dim gold bag.", "faded tomato bags contain 2 wavy beige bags.", "shiny lime bags contain no other bags.", "shiny fuchsia bags contain 5 muted orange bags, 2 shiny plum bags, 1 plaid turquoise bag.", "light indigo bags contain 2 dim purple bags, 4 faded magenta bags, 3 dim black bags.", "faded aqua bags contain 2 drab beige bags, 3 bright aqua bags, 3 drab plum bags, 2 dotted silver bags.", "posh blue bags contain 1 wavy magenta bag, 5 posh magenta bags.", "dotted crimson bags contain 3 striped gold bags, 3 dark yellow bags.", "striped salmon bags contain 1 dark tomato bag, 5 shiny coral bags, 5 plaid silver bags.", "clear brown bags contain 2 muted olive bags, 5 plaid gold bags.", "clear orange bags contain 5 posh plum bags, 1 posh lavender bag, 3 dull cyan bags.", "shiny teal bags contain 4 muted gold bags, 3 striped chartreuse bags.", "dim bronze bags contain 4 dull lavender bags.", "shiny silver bags contain 3 dull plum bags, 5 vibrant indigo bags, 4 striped bronze bags, 4 posh tomato bags.", "dim tomato bags contain 5 wavy indigo bags, 3 wavy gold bags, 5 dim beige bags.", "vibrant white bags contain 5 dim magenta bags, 2 posh silver bags, 5 dull maroon bags.", "dark blue bags contain 4 striped green bags, 4 dotted violet bags, 4 bright red bags.", "plaid gray bags contain 4 faded gray bags, 3 dark brown bags.", "mirrored indigo bags contain 3 dim crimson bags.", "mirrored cyan bags contain 5 faded teal bags, 4 striped tan bags, 3 bright fuchsia bags, 3 striped bronze bags.", "dotted red bags contain 5 muted olive bags, 1 posh lavender bag, 2 faded maroon bags, 3 bright tomato bags.", "clear crimson bags contain 4 muted aqua bags, 2 dark lavender bags.", "mirrored brown bags contain 3 drab beige bags, 5 striped lavender bags, 4 dark red bags, 4 faded brown bags.", "pale gray bags contain 4 vibrant brown bags, 5 dark chartreuse bags, 3 vibrant gold bags, 2 striped tan bags.", "bright gray bags contain 2 dull chartreuse bags, 1 dull purple bag, 3 dotted violet bags.", "dotted purple bags contain 5 shiny silver bags, 2 mirrored white bags, 3 shiny indigo bags.", "dotted indigo bags contain 3 bright gray bags, 2 light tomato bags, 4 dim violet bags, 3 dull chartreuse bags.", "wavy orange bags contain 4 muted maroon bags, 5 clear salmon bags, 5 dark orange bags.", "dark plum bags contain 2 muted tomato bags, 3 shiny gold bags, 4 striped chartreuse bags.", "vibrant yellow bags contain 5 dark red bags, 4 shiny gold bags, 3 light silver bags, 2 faded yellow bags.", "vibrant bronze bags contain 5 clear blue bags.", "striped silver bags contain 4 faded cyan bags, 5 posh fuchsia bags.", "dull yellow bags contain 4 shiny silver bags, 2 posh maroon bags, 1 mirrored lavender bag, 2 dull lavender bags.", "wavy turquoise bags contain 4 muted gold bags.", "drab salmon bags contain 4 dotted yellow bags, 4 posh aqua bags, 1 dull beige bag.", "posh green bags contain 5 mirrored lavender bags, 5 dim maroon bags, 2 faded gray bags, 1 wavy lavender bag.", "muted gold bags contain no other bags.", "mirrored aqua bags contain 4 posh olive bags, 5 shiny bronze bags, 4 drab blue bags.", "wavy tan bags contain 2 wavy green bags, 5 faded brown bags.", "mirrored magenta bags contain 1 plaid black bag, 1 clear violet bag.", "mirrored lime bags contain 1 clear cyan bag, 3 pale maroon bags, 5 striped teal bags.", "dark crimson bags contain 2 vibrant black bags, 4 clear violet bags, 2 vibrant indigo bags.", "striped blue bags contain 4 vibrant cyan bags, 3 striped chartreuse bags, 4 bright tan bags, 2 dull lime bags.", "wavy chartreuse bags contain 4 dotted silver bags, 3 drab red bags, 5 posh olive bags.", "clear magenta bags contain 3 clear orange bags, 1 plaid plum bag.", "dim beige bags contain 3 vibrant maroon bags, 2 shiny silver bags, 4 faded lavender bags.", "striped tan bags contain 5 mirrored olive bags, 4 dark maroon bags.", "faded green bags contain 1 posh white bag, 1 dotted crimson bag.", "drab teal bags contain 4 bright fuchsia bags.", "posh lavender bags contain 3 bright red bags, 2 shiny lime bags, 2 bright chartreuse bags.", "bright tan bags contain 5 clear blue bags, 2 dark red bags, 3 bright maroon bags.", "light red bags contain 5 mirrored plum bags, 3 vibrant black bags, 5 vibrant gray bags.", "light white bags contain 2 drab beige bags.", "faded gray bags contain 5 dim plum bags, 1 bright aqua bag.", "light gray bags contain 3 dark plum bags, 2 vibrant silver bags, 1 faded gold bag.", "light teal bags contain 5 dark lavender bags.", "muted teal bags contain 4 striped chartreuse bags, 2 muted gold bags, 1 mirrored green bag, 5 dull orange bags.", "dull chartreuse bags contain 5 wavy maroon bags, 5 posh black bags, 1 shiny purple bag, 2 bright tan bags.", "vibrant salmon bags contain 3 faded beige bags, 1 faded magenta bag.", "mirrored gold bags contain 2 dark orange bags.", "dark yellow bags contain 1 plaid brown bag, 3 dull lime bags, 4 shiny gold bags, 4 drab beige bags.", "plaid crimson bags contain 4 pale chartreuse bags, 3 vibrant indigo bags.", "shiny gold bags contain 1 muted olive bag, 5 dotted red bags, 1 drab plum bag.", "pale olive bags contain 4 dark maroon bags, 1 clear red bag.", "dotted magenta bags contain 2 dark purple bags.", "striped violet bags contain 5 plaid salmon bags, 4 mirrored cyan bags, 2 faded crimson bags, 3 mirrored fuchsia bags.", "faded lime bags contain 2 vibrant brown bags, 1 dim purple bag.", "muted magenta bags contain 4 wavy tomato bags, 2 plaid black bags, 5 mirrored olive bags, 2 muted turquoise bags.", "dim lime bags contain 1 wavy beige bag, 2 light olive bags.", "plaid cyan bags contain 3 muted yellow bags.", "dotted maroon bags contain 3 vibrant green bags, 2 light purple bags.", "striped gray bags contain 3 plaid tomato bags.", "light violet bags contain 2 striped tomato bags, 1 mirrored beige bag, 4 clear magenta bags, 3 muted red bags.", "vibrant gold bags contain 2 striped blue bags, 4 dull orange bags, 2 striped fuchsia bags.", "vibrant lavender bags contain 2 bright red bags, 3 dull chartreuse bags.", "clear yellow bags contain 2 clear orange bags.", "muted black bags contain 2 wavy beige bags, 3 light magenta bags, 5 plaid chartreuse bags.", "pale brown bags contain 5 wavy red bags, 4 vibrant red bags.", "plaid purple bags contain 4 dotted violet bags, 1 muted white bag.", "vibrant fuchsia bags contain 3 mirrored silver bags.", "light purple bags contain 3 light green bags, 4 wavy lime bags, 5 striped chartreuse bags, 4 shiny blue bags.", "mirrored white bags contain 4 bright brown bags, 2 striped silver bags.", "dull silver bags contain 5 shiny gray bags.", "dark magenta bags contain 1 light turquoise bag, 4 plaid brown bags.", "faded red bags contain 2 striped tan bags.", "mirrored beige bags contain 4 clear yellow bags, 3 mirrored orange bags, 1 posh lavender bag.", "faded coral bags contain 1 striped blue bag, 2 shiny purple bags, 5 muted purple bags.", "shiny cyan bags contain 3 clear purple bags, 2 dim orange bags, 1 dark teal bag, 4 mirrored chartreuse bags.", "posh gray bags contain 3 bright red bags, 3 faded maroon bags.", "dim cyan bags contain 5 light white bags.", "dotted tomato bags contain 5 plaid lime bags, 4 shiny plum bags, 1 wavy blue bag.", "dark teal bags contain 4 shiny turquoise bags, 5 faded green bags.", "muted cyan bags contain 2 bright maroon bags, 1 posh coral bag, 3 light bronze bags, 1 dim tomato bag.", "dotted yellow bags contain 3 bright maroon bags, 4 dim lime bags, 3 faded aqua bags, 2 plaid magenta bags.", "dark cyan bags contain 4 faded beige bags.", "dark bronze bags contain 1 pale white bag, 4 shiny chartreuse bags, 1 vibrant cyan bag, 1 muted yellow bag.", "drab cyan bags contain 5 clear blue bags, 4 bright tan bags, 5 wavy red bags.", "drab white bags contain 5 shiny yellow bags.", "bright cyan bags contain 3 bright brown bags, 2 clear gold bags, 4 striped white bags, 3 dark yellow bags.", "dull lavender bags contain 4 mirrored brown bags, 4 pale salmon bags.", "shiny olive bags contain 1 plaid beige bag.", "posh fuchsia bags contain 5 posh gray bags.", "plaid aqua bags contain 4 faded turquoise bags, 4 striped silver bags, 4 shiny beige bags, 3 dark cyan bags.", "shiny plum bags contain 3 dull tomato bags.", "striped chartreuse bags contain 4 posh black bags, 1 vibrant cyan bag, 2 bright chartreuse bags.", "pale red bags contain 2 vibrant bronze bags, 3 posh black bags, 4 bright tomato bags.", "plaid maroon bags contain 2 dotted coral bags, 4 wavy tomato bags, 3 pale blue bags.", "shiny beige bags contain 4 faded aqua bags.", "plaid silver bags contain 2 light gold bags, 2 wavy green bags, 4 posh cyan bags.", "light cyan bags contain 5 shiny tomato bags, 1 wavy magenta bag.", "faded silver bags contain 4 striped bronze bags, 3 pale coral bags, 2 dim salmon bags.", "light green bags contain 5 vibrant maroon bags, 3 muted indigo bags.", "faded maroon bags contain 5 dull lime bags, 1 plaid black bag, 5 drab beige bags, 5 clear gray bags.", "posh tan bags contain 3 dim violet bags, 2 plaid turquoise bags, 4 pale turquoise bags, 1 dim chartreuse bag.", "muted silver bags contain 3 muted brown bags, 2 dotted crimson bags.", "mirrored turquoise bags contain 4 bright cyan bags, 1 light turquoise bag, 4 dark silver bags, 3 light coral bags.", "clear coral bags contain 2 clear gray bags, 3 posh plum bags, 4 muted indigo bags, 3 pale chartreuse bags.", "clear teal bags contain 2 light turquoise bags, 1 striped white bag.", "muted lavender bags contain 5 posh brown bags, 3 striped blue bags, 3 clear blue bags.", "shiny tan bags contain 1 light olive bag.", "dark salmon bags contain 2 dull teal bags, 1 muted aqua bag, 5 dark crimson bags.", "plaid orange bags contain 3 dull plum bags, 5 dim maroon bags, 2 faded maroon bags.", "clear black bags contain 5 shiny beige bags, 1 plaid tomato bag, 2 dull magenta bags.", "bright red bags contain no other bags.", "striped tomato bags contain 5 posh lavender bags, 2 dark teal bags, 2 drab bronze bags, 2 drab chartreuse bags.", "light maroon bags contain 1 faded magenta bag, 4 mirrored chartreuse bags.", "dark indigo bags contain 5 striped purple bags, 1 clear tomato bag, 4 light beige bags.", "faded violet bags contain 1 striped tan bag.", "clear violet bags contain 1 plaid tan bag, 2 light salmon bags.", "dotted violet bags contain 4 light silver bags.", "dotted brown bags contain 3 dim gold bags, 3 drab chartreuse bags.", "wavy gray bags contain 2 drab tan bags.", "faded black bags contain 1 faded aqua bag, 3 bright gray bags.", "shiny bronze bags contain 4 muted salmon bags, 5 plaid lime bags, 1 faded maroon bag, 3 mirrored silver bags.", "faded purple bags contain 3 wavy beige bags, 5 shiny silver bags.", "dim plum bags contain 5 light salmon bags, 4 plaid plum bags, 2 posh crimson bags.", "plaid turquoise bags contain 1 bright purple bag, 5 muted tomato bags.", "clear tomato bags contain 2 striped bronze bags.", "bright green bags contain 3 plaid chartreuse bags, 5 dim orange bags, 4 dull magenta bags.", "drab tomato bags contain 5 wavy tomato bags, 5 posh gold bags.", "clear indigo bags contain 1 posh white bag, 5 drab plum bags.", "bright crimson bags contain 4 faded salmon bags.", "dark coral bags contain 3 clear indigo bags, 5 dull cyan bags, 5 faded teal bags.", "light salmon bags contain 2 muted salmon bags, 3 posh brown bags.", "dark purple bags contain 2 shiny chartreuse bags, 5 clear cyan bags, 4 striped fuchsia bags, 5 light silver bags.", "dotted beige bags contain 5 muted olive bags, 2 vibrant cyan bags, 4 light turquoise bags.", "muted crimson bags contain 5 drab plum bags.", "wavy gold bags contain 5 faded red bags, 4 bright purple bags, 3 drab plum bags, 4 dotted red bags.", "faded crimson bags contain 5 bright maroon bags.", "shiny chartreuse bags contain 5 posh black bags, 1 clear blue bag.", "dull magenta bags contain 5 vibrant beige bags, 2 dull chartreuse bags.", "shiny turquoise bags contain 4 faded teal bags.", "drab aqua bags contain 1 muted white bag, 1 wavy beige bag, 5 bright cyan bags.", "dim teal bags contain 5 vibrant silver bags.", "light yellow bags contain 3 dull lime bags, 1 dotted red bag, 3 pale turquoise bags, 4 clear gold bags.", "striped olive bags contain 1 clear teal bag, 5 dim violet bags.", "dark green bags contain 1 posh black bag, 3 striped fuchsia bags.", "light black bags contain 2 clear beige bags, 5 mirrored beige bags, 2 pale blue bags.", "dull brown bags contain 4 posh tomato bags, 2 faded beige bags, 4 bright violet bags.", "shiny green bags contain 4 wavy tomato bags, 1 faded teal bag, 3 muted maroon bags, 2 striped crimson bags.", "shiny salmon bags contain 1 clear gray bag, 3 light gold bags, 2 mirrored green bags.", "clear aqua bags contain 5 striped chartreuse bags, 1 light tomato bag, 1 pale bronze bag.", "wavy beige bags contain 4 muted salmon bags, 1 dark bronze bag, 4 plaid yellow bags.", "plaid yellow bags contain 5 mirrored cyan bags, 1 vibrant violet bag, 3 vibrant coral bags, 5 dim cyan bags.", "clear beige bags contain 5 bright red bags.", "clear lime bags contain 2 vibrant coral bags, 5 dark lavender bags, 2 pale teal bags.", "vibrant beige bags contain 1 bright tomato bag, 2 drab red bags, 4 mirrored cyan bags.", "bright yellow bags contain 1 pale beige bag, 3 dim lime bags, 5 posh white bags.", "plaid plum bags contain 1 light salmon bag, 5 faded yellow bags, 2 shiny brown bags.", "plaid green bags contain 3 posh plum bags, 5 mirrored violet bags, 5 light lavender bags, 4 plaid plum bags.", "dull tan bags contain 1 drab white bag, 1 vibrant bronze bag, 3 dotted crimson bags.", "clear bronze bags contain 3 clear gray bags, 1 dim beige bag.", "vibrant crimson bags contain 4 shiny plum bags, 4 vibrant orange bags.", "vibrant orange bags contain 2 bright tomato bags, 3 shiny indigo bags, 2 dotted turquoise bags, 4 striped tan bags.", "plaid beige bags contain 2 light white bags.", "dull indigo bags contain 1 faded salmon bag, 3 vibrant cyan bags.", "muted white bags contain 4 striped fuchsia bags.", "shiny aqua bags contain 1 shiny teal bag, 4 wavy cyan bags, 2 dark green bags, 4 bright aqua bags.", "bright fuchsia bags contain 3 shiny chartreuse bags, 5 vibrant bronze bags.", "dull bronze bags contain 5 drab fuchsia bags, 3 pale beige bags, 2 posh lavender bags.", "muted maroon bags contain 2 posh fuchsia bags, 1 drab plum bag, 1 shiny orange bag.", "striped fuchsia bags contain 4 posh lavender bags, 5 dull cyan bags, 2 posh black bags, 2 vibrant bronze bags.", "shiny tomato bags contain 5 pale violet bags.", "wavy lime bags contain 5 bright red bags, 2 bright brown bags, 1 dark olive bag.", "wavy tomato bags contain 1 drab tan bag, 1 bright maroon bag, 3 mirrored fuchsia bags.", "striped coral bags contain 2 pale plum bags, 5 muted maroon bags.", "clear silver bags contain 2 striped turquoise bags.", "vibrant tomato bags contain 4 drab lime bags, 3 dim coral bags, 3 mirrored tan bags.", "faded gold bags contain 4 dull black bags.", "striped bronze bags contain 5 dark red bags, 2 light lavender bags, 5 muted olive bags, 4 posh gray bags.", "dotted chartreuse bags contain 2 dull brown bags, 4 dim red bags, 3 drab beige bags.", "vibrant coral bags contain 3 shiny turquoise bags, 1 striped orange bag.", "faded lavender bags contain 5 shiny lime bags.", "dull turquoise bags contain 2 dark olive bags, 3 dark coral bags, 3 shiny purple bags, 3 clear turquoise bags.", "shiny yellow bags contain 4 dim gold bags, 4 vibrant silver bags, 1 dark yellow bag.", "plaid lavender bags contain 4 vibrant violet bags, 3 striped silver bags, 2 muted crimson bags, 1 light tan bag.", "mirrored fuchsia bags contain 3 clear gray bags.", "wavy white bags contain 3 dim turquoise bags.", "clear purple bags contain 1 shiny chartreuse bag.", "dark chartreuse bags contain 1 dim blue bag, 2 dark maroon bags, 1 light lavender bag, 1 drab black bag.", "wavy purple bags contain 2 vibrant brown bags, 3 faded olive bags, 5 dim gold bags, 1 dull brown bag.", "bright lavender bags contain 1 muted white bag.", "shiny red bags contain 4 muted aqua bags, 5 striped teal bags, 1 dark violet bag.", "pale aqua bags contain 3 dark teal bags, 3 dull violet bags.", "wavy brown bags contain 4 posh brown bags, 3 posh crimson bags, 4 mirrored lavender bags.", "clear chartreuse bags contain 2 bright tan bags.", "mirrored chartreuse bags contain 5 plaid black bags, 3 dark turquoise bags, 2 posh maroon bags, 4 striped silver bags.", "pale turquoise bags contain 2 dark red bags, 3 plaid white bags, 5 faded tomato bags, 4 dim coral bags.", "dotted blue bags contain 4 bright lavender bags.", "bright plum bags contain 5 plaid salmon bags, 1 dark purple bag, 2 muted violet bags, 3 dark olive bags.", "pale black bags contain 1 dark plum bag.", "dotted coral bags contain 4 muted magenta bags, 2 faded magenta bags, 1 clear brown bag.", "plaid magenta bags contain 2 light green bags, 2 vibrant coral bags, 2 faded beige bags, 1 dim teal bag.", "striped lavender bags contain 4 clear gray bags, 3 muted teal bags, 5 drab beige bags, 1 striped bronze bag.", "striped magenta bags contain 3 dull fuchsia bags, 2 posh olive bags, 5 shiny coral bags, 1 dull tan bag.", "pale tan bags contain 1 pale olive bag, 4 mirrored teal bags.", "light crimson bags contain 4 dull purple bags.", "pale coral bags contain 4 dotted red bags, 1 plaid salmon bag.", "vibrant blue bags contain 5 shiny yellow bags, 2 drab silver bags, 1 faded black bag, 1 faded lime bag.", "dark tan bags contain 1 shiny brown bag, 4 dark green bags, 3 drab blue bags, 4 drab tan bags.", "drab olive bags contain 5 vibrant yellow bags.", "wavy violet bags contain 5 shiny coral bags.", "plaid gold bags contain 1 pale salmon bag, 4 plaid beige bags.", "plaid bronze bags contain 5 bright blue bags, 1 wavy green bag, 3 clear magenta bags.", "wavy cyan bags contain 2 clear red bags, 5 clear indigo bags.", "vibrant black bags contain 2 mirrored green bags.", "faded white bags contain 4 light green bags, 4 vibrant teal bags, 5 wavy black bags.", "mirrored orange bags contain 4 muted tomato bags.", "dark gold bags contain 1 muted turquoise bag, 4 mirrored olive bags, 2 dim maroon bags, 1 posh olive bag.", "muted turquoise bags contain 1 plaid tomato bag.", "dull blue bags contain 1 dotted silver bag, 2 vibrant beige bags, 3 muted salmon bags, 2 faded teal bags.", "light tomato bags contain 4 dark maroon bags, 2 pale red bags, 4 dark red bags.", "striped turquoise bags contain 5 dull cyan bags, 4 bright violet bags, 2 faded violet bags, 5 posh silver bags.", "wavy magenta bags contain 1 muted indigo bag, 5 bright brown bags, 5 striped tan bags.", "posh bronze bags contain 1 striped fuchsia bag, 5 dotted salmon bags, 3 striped bronze bags.", "drab silver bags contain 2 plaid white bags, 2 plaid lime bags.", "bright maroon bags contain no other bags.", "dull red bags contain 5 wavy blue bags, 3 light green bags, 4 mirrored plum bags, 3 mirrored purple bags.", "pale gold bags contain 3 drab plum bags, 5 light salmon bags.", "wavy red bags contain 4 light lavender bags, 5 drab beige bags.", "mirrored gray bags contain 3 drab white bags, 1 posh brown bag.", "drab plum bags contain 5 vibrant bronze bags, 1 muted olive bag, 1 striped tan bag.", "mirrored teal bags contain 5 plaid brown bags, 3 plaid salmon bags.", "dotted tan bags contain 3 drab lavender bags, 1 dark bronze bag, 5 vibrant indigo bags, 1 muted purple bag.", "dark gray bags contain 5 vibrant yellow bags, 4 posh lavender bags, 1 drab olive bag, 1 dark lavender bag.", "pale indigo bags contain 4 mirrored silver bags.", "bright white bags contain 4 clear magenta bags.", "clear white bags contain 4 faded olive bags.", "faded tan bags contain 1 wavy tomato bag, 3 bright cyan bags, 4 drab beige bags, 3 striped turquoise bags.", "striped lime bags contain 3 dim lime bags, 1 light orange bag.", "dim blue bags contain 3 bright maroon bags.", "mirrored tomato bags contain 3 plaid silver bags.", "wavy coral bags contain 4 wavy yellow bags, 4 faded white bags.", "dark silver bags contain 4 clear cyan bags, 3 vibrant yellow bags, 2 posh gray bags, 2 shiny gold bags.", "dim fuchsia bags contain 3 plaid orange bags, 2 wavy chartreuse bags, 3 pale chartreuse bags.", "light lime bags contain 2 striped brown bags, 3 muted red bags, 1 posh crimson bag, 5 bright green bags.", "mirrored red bags contain 4 wavy beige bags, 5 dim turquoise bags.", "light chartreuse bags contain 4 wavy yellow bags, 2 light yellow bags.", "dull teal bags contain 4 dotted gold bags, 4 faded maroon bags.", "dull aqua bags contain 4 dull purple bags, 2 light lavender bags.", "pale white bags contain 3 pale maroon bags.", "wavy salmon bags contain 4 posh brown bags, 1 light brown bag, 5 light orange bags, 3 dotted olive bags.", "faded chartreuse bags contain 4 bright tan bags, 4 mirrored silver bags, 4 dotted maroon bags, 5 dark beige bags.", "posh beige bags contain 4 dim teal bags.", "posh crimson bags contain 5 dark silver bags, 4 vibrant yellow bags, 1 posh gray bag.", "shiny orange bags contain 3 vibrant cyan bags, 1 wavy red bag, 3 bright chartreuse bags, 2 striped tan bags.", "wavy lavender bags contain 1 dim gold bag, 4 clear blue bags, 1 plaid crimson bag, 3 faded magenta bags.", "vibrant aqua bags contain 1 muted black bag, 5 pale lavender bags, 3 dim cyan bags.", "dim magenta bags contain 2 dark salmon bags, 1 dark orange bag.", "wavy olive bags contain 3 shiny olive bags, 2 bright silver bags.", "dull green bags contain 3 drab red bags, 4 muted turquoise bags, 3 plaid brown bags, 4 mirrored olive bags.", "dotted gray bags contain 5 vibrant olive bags, 4 drab fuchsia bags.", "mirrored salmon bags contain 5 faded indigo bags, 5 vibrant indigo bags.", "faded orange bags contain 5 striped brown bags, 5 muted violet bags.", "plaid black bags contain 5 dark green bags, 4 bright fuchsia bags, 2 shiny lime bags.", "dull coral bags contain 1 bright tan bag, 4 muted salmon bags, 1 bright gray bag.", "pale chartreuse bags contain 4 faded crimson bags, 4 dotted gold bags, 4 posh crimson bags.", "mirrored black bags contain 3 light white bags, 1 muted magenta bag, 1 mirrored turquoise bag, 4 bright plum bags.", "drab crimson bags contain 1 light tan bag, 3 dull green bags, 1 wavy blue bag.", "muted orange bags contain 5 dull fuchsia bags.", "pale orange bags contain 4 vibrant gray bags.", "clear salmon bags contain 3 clear aqua bags.", "dull tomato bags contain 2 light maroon bags, 2 muted lavender bags, 1 muted red bag, 1 faded brown bag.", "pale crimson bags contain 5 mirrored chartreuse bags.", "dotted white bags contain 2 posh brown bags.", "posh teal bags contain 4 dotted salmon bags, 1 dark violet bag.", "dim coral bags contain 2 striped white bags.", "bright aqua bags contain 4 bright red bags, 5 bright tan bags, 5 dotted violet bags.", "dark beige bags contain 2 dull aqua bags, 2 drab blue bags.", "bright teal bags contain 5 drab white bags.", "dotted silver bags contain 3 dull orange bags.", "striped maroon bags contain 4 drab violet bags, 2 light black bags, 4 light lavender bags.", "pale magenta bags contain 4 pale gray bags.", "shiny maroon bags contain 2 vibrant beige bags, 2 drab lime bags, 4 vibrant turquoise bags, 2 dull chartreuse bags.", "dark black bags contain 1 dark white bag, 1 wavy crimson bag, 3 plaid tan bags, 5 striped red bags.", "posh white bags contain 5 vibrant gold bags.", "muted aqua bags contain 5 vibrant gray bags, 4 dull chartreuse bags, 3 bright plum bags, 1 dark orange bag.", "pale cyan bags contain 3 muted white bags, 1 dark olive bag.", "plaid white bags contain 4 plaid black bags, 4 light white bags, 3 plaid salmon bags.", "bright beige bags contain 3 posh magenta bags, 2 clear yellow bags, 1 faded plum bag.", "dotted black bags contain 1 muted olive bag.", "bright purple bags contain 4 mirrored cyan bags, 1 faded violet bag, 1 dark olive bag.", "faded plum bags contain 5 mirrored olive bags, 4 light silver bags.", "dull gold bags contain 5 light yellow bags, 4 pale gold bags, 2 dotted orange bags.", "dark tomato bags contain 4 muted gold bags, 3 shiny gold bags, 3 bright red bags.", "pale yellow bags contain 4 drab plum bags, 1 clear teal bag, 4 faded purple bags, 2 posh bronze bags.", "vibrant turquoise bags contain 3 dim violet bags, 2 muted silver bags, 3 plaid cyan bags, 3 faded aqua bags.", "mirrored coral bags contain 2 posh aqua bags, 4 bright violet bags, 2 dark salmon bags.", "muted salmon bags contain 1 vibrant indigo bag.", "pale plum bags contain 5 mirrored teal bags, 1 drab tan bag, 3 plaid crimson bags.", "clear gold bags contain 3 dull cyan bags, 3 plaid brown bags, 1 muted tomato bag.", "muted chartreuse bags contain 4 posh gray bags, 5 drab purple bags.", "light coral bags contain 4 clear purple bags, 5 drab beige bags.", "faded indigo bags contain 1 dull brown bag.", "bright turquoise bags contain 5 drab bronze bags.", "clear plum bags contain 3 dark red bags, 3 dim gold bags, 2 posh black bags, 5 plaid beige bags.", "plaid chartreuse bags contain 1 wavy yellow bag, 3 mirrored olive bags.", "faded bronze bags contain 2 light salmon bags.", "bright lime bags contain 3 faded teal bags, 5 dotted coral bags, 1 faded crimson bag.", "drab violet bags contain 1 faded beige bag, 2 mirrored chartreuse bags, 2 clear orange bags, 4 dotted beige bags.", "dull olive bags contain 5 muted lime bags, 3 dark yellow bags.", "wavy indigo bags contain 1 clear tan bag, 5 vibrant green bags.", "posh indigo bags contain 5 drab salmon bags.", "dull cyan bags contain no other bags.", "plaid brown bags contain 5 striped tan bags, 2 dark maroon bags, 4 dim chartreuse bags, 3 dull lime bags.", "mirrored purple bags contain 5 drab green bags, 2 clear green bags.", "striped plum bags contain 5 dim white bags, 4 dark teal bags.", "dim lavender bags contain 5 striped bronze bags, 3 wavy maroon bags.", "dim chartreuse bags contain 3 shiny gold bags, 2 mirrored olive bags.", }
day7/input/input.go
0.595257
0.840946
input.go
starcoder
package ffmpeg import ( "fmt" "runtime" ) // Arger is an interface that can be used to append arguments to an Args slice. type Arger interface { Args() []string } // Args represents a slice of arguments to be passed to ffmpeg. type Args []string // LogLevel sets the LogLevel to l and returns the result. func (a Args) LogLevel(l LogLevel) Args { if l == "" { return a } return append(a, l.Args()...) } // XError adds the -xerror flag and returns the result. func (a Args) XError() Args { return append(a, "-xerror") } // Overwrite adds the overwrite flag (-y) and returns the result. func (a Args) Overwrite() Args { return append(a, "-y") } // Seek adds a seek (-ss) to the given seconds and returns the result. func (a Args) Seek(seconds float64) Args { return append(a, "-ss", fmt.Sprint(seconds)) } // Duration sets the duration (-t) to the given seconds and returns the result. func (a Args) Duration(seconds float64) Args { return append(a, "-t", fmt.Sprint(seconds)) } // Input adds the input (-i) and returns the result. func (a Args) Input(i string) Args { return append(a, "-i", i) } // Output adds the output o and returns the result. func (a Args) Output(o string) Args { return append(a, o) } // NullOutput adds a null output and returns the result. // On Windows, this outputs to NUL, on everything else, /dev/null. func (a Args) NullOutput() Args { var output string if runtime.GOOS == "windows" { output = "nul" // https://stackoverflow.com/questions/313111/is-there-a-dev-null-on-windows } else { output = "/dev/null" } return a.Output(output) } // VideoFrames adds the -frames:v with f and returns the result. func (a Args) VideoFrames(f int) Args { return append(a, "-frames:v", fmt.Sprint(f)) } // FixedQualityScaleVideo adds the -q:v argument with q and returns the result. func (a Args) FixedQualityScaleVideo(q int) Args { return append(a, "-q:v", fmt.Sprint(q)) } // VideoFilter adds the vf video filter and returns the result. func (a Args) VideoFilter(vf VideoFilter) Args { return append(a, vf.Args()...) } // VSync adds the VsyncMethod and returns the result. func (a Args) VSync(m VSyncMethod) Args { return append(a, m.Args()...) } // AudioBitrate adds the -b:a argument with b and returns the result. func (a Args) AudioBitrate(b string) Args { return append(a, "-b:a", b) } // MaxMuxingQueueSize adds the -max_muxing_queue_size argument with s and returns the result. func (a Args) MaxMuxingQueueSize(s int) Args { // https://trac.ffmpeg.org/ticket/6375 return append(a, "-max_muxing_queue_size", fmt.Sprint(s)) } // SkipAudio adds the skip audio flag (-an) and returns the result. func (a Args) SkipAudio() Args { return append(a, "-an") } // VideoCodec adds the given video codec and returns the result. func (a Args) VideoCodec(c VideoCodec) Args { return append(a, c.Args()...) } // AudioCodec adds the given audio codec and returns the result. func (a Args) AudioCodec(c AudioCodec) Args { return append(a, c.Args()...) } // Format adds the format flag with f and returns the result. func (a Args) Format(f Format) Args { return append(a, f.Args()...) } // ImageFormat adds the image format (using -f) and returns the result. func (a Args) ImageFormat(f ImageFormat) Args { return append(a, f.Args()...) } // AppendArgs appends the given Arger to the Args and returns the result. func (a Args) AppendArgs(o Arger) Args { return append(a, o.Args()...) } // Args returns a string slice of the arguments. func (a Args) Args() []string { return []string(a) } // LogLevel represents the log level of ffmpeg. type LogLevel string // Args returns the arguments to set the log level in ffmpeg. func (l LogLevel) Args() []string { if l == "" { return nil } return []string{"-v", string(l)} } // LogLevels for ffmpeg. See -v entry under https://ffmpeg.org/ffmpeg.html#Generic-options var ( LogLevelQuiet LogLevel = "quiet" LogLevelPanic LogLevel = "panic" LogLevelFatal LogLevel = "fatal" LogLevelError LogLevel = "error" LogLevelWarning LogLevel = "warning" LogLevelInfo LogLevel = "info" LogLevelVerbose LogLevel = "verbose" LogLevelDebug LogLevel = "debug" LogLevelTrace LogLevel = "trace" ) // VSyncMethod represents the vsync method of ffmpeg. type VSyncMethod string // Args returns the arguments to set the vsync method in ffmpeg. func (m VSyncMethod) Args() []string { if m == "" { return nil } return []string{"-vsync", string(m)} } // Video sync methods for ffmpeg. See -vsync entry under https://ffmpeg.org/ffmpeg.html#Advanced-options var ( VSyncMethodPassthrough VSyncMethod = "0" VSyncMethodCFR VSyncMethod = "1" VSyncMethodVFR VSyncMethod = "2" VSyncMethodDrop VSyncMethod = "drop" VSyncMethodAuto VSyncMethod = "-1" )
pkg/ffmpeg/options.go
0.826991
0.445891
options.go
starcoder
package engine import ( "math" "regexp" "strconv" "strings" "github.com/golang/glog" "github.com/minio/minio/pkg/wildcard" ) // Operator is string alias that represents selection operators enum type Operator string const ( // Equal stands for == Equal Operator = "" // MoreEqual stands for >= MoreEqual Operator = ">=" // LessEqual stands for <= LessEqual Operator = "<=" // NotEqual stands for ! NotEqual Operator = "!" // More stands for > More Operator = ">" // Less stands for < Less Operator = "<" ) const relativePrefix Operator = "./" const referenceSign Operator = "$()" // ValidateValueWithPattern validates value with operators and wildcards func ValidateValueWithPattern(value, pattern interface{}) bool { switch typedPattern := pattern.(type) { case bool: typedValue, ok := value.(bool) if !ok { glog.V(4).Infof("Expected bool, found %T", value) return false } return typedPattern == typedValue case int: return validateValueWithIntPattern(value, int64(typedPattern)) case int64: return validateValueWithIntPattern(value, typedPattern) case float64: return validateValueWithFloatPattern(value, typedPattern) case string: return validateValueWithStringPatterns(value, typedPattern) case nil: return validateValueWithNilPattern(value) case map[string]interface{}: // TODO: check if this is ever called? return validateValueWithMapPattern(value, typedPattern) case []interface{}: // TODO: check if this is ever called? glog.Warning("Arrays as patterns are not supported") return false default: glog.Warningf("Unknown type as pattern: %T\n", pattern) return false } } func validateValueWithMapPattern(value interface{}, typedPattern map[string]interface{}) bool { // verify the type of the resource value is map[string]interface, // we only check for existance of object, not the equality of content and value //TODO: check if adding _, ok := value.(map[string]interface{}) if !ok { glog.Warningf("Expected map[string]interface{}, found %T\n", value) return false } return true } // Handler for int values during validation process func validateValueWithIntPattern(value interface{}, pattern int64) bool { switch typedValue := value.(type) { case int: return int64(typedValue) == pattern case int64: return typedValue == pattern case float64: // check that float has no fraction if typedValue == math.Trunc(typedValue) { return int64(typedValue) == pattern } glog.Warningf("Expected int, found float: %f\n", typedValue) return false case string: // extract int64 from string int64Num, err := strconv.ParseInt(typedValue, 10, 64) if err != nil { glog.Warningf("Failed to parse int64 from string: %v", err) return false } return int64Num == pattern default: glog.Warningf("Expected int, found: %T\n", value) return false } } // Handler for float values during validation process func validateValueWithFloatPattern(value interface{}, pattern float64) bool { switch typedValue := value.(type) { case int: // check that float has no fraction if pattern == math.Trunc(pattern) { return int(pattern) == value } glog.Warningf("Expected float, found int: %d\n", typedValue) return false case int64: // check that float has no fraction if pattern == math.Trunc(pattern) { return int64(pattern) == value } glog.Warningf("Expected float, found int: %d\n", typedValue) return false case float64: return typedValue == pattern case string: // extract float64 from string float64Num, err := strconv.ParseFloat(typedValue, 64) if err != nil { glog.Warningf("Failed to parse float64 from string: %v", err) return false } return float64Num == pattern default: glog.Warningf("Expected float, found: %T\n", value) return false } } // Handler for nil values during validation process func validateValueWithNilPattern(value interface{}) bool { switch typed := value.(type) { case float64: return typed == 0.0 case int: return typed == 0 case int64: return typed == 0 case string: return typed == "" case bool: return typed == false case nil: return true case map[string]interface{}, []interface{}: glog.Warningf("Maps and arrays could not be checked with nil pattern") return false default: glog.Warningf("Unknown type as value when checking for nil pattern: %T\n", value) return false } } // Handler for pattern values during validation process func validateValueWithStringPatterns(value interface{}, pattern string) bool { statements := strings.Split(pattern, "|") for _, statement := range statements { statement = strings.Trim(statement, " ") if validateValueWithStringPattern(value, statement) { return true } } return false } // Handler for single pattern value during validation process // Detects if pattern has a number func validateValueWithStringPattern(value interface{}, pattern string) bool { operator := getOperatorFromStringPattern(pattern) pattern = pattern[len(operator):] number, str := getNumberAndStringPartsFromPattern(pattern) if "" == number { return validateString(value, str, operator) } return validateNumberWithStr(value, number, str, operator) } // Handler for string values func validateString(value interface{}, pattern string, operator Operator) bool { if NotEqual == operator || Equal == operator { strValue, ok := value.(string) if !ok { glog.Warningf("Expected string, found %T\n", value) return false } wildcardResult := wildcard.Match(pattern, strValue) if NotEqual == operator { return !wildcardResult } return wildcardResult } glog.Warningf("Operators >, >=, <, <= are not applicable to strings") return false } // validateNumberWithStr applies wildcard to suffix and operator to numerical part func validateNumberWithStr(value interface{}, patternNumber, patternStr string, operator Operator) bool { // pattern has suffix if "" != patternStr { typedValue, ok := value.(string) if !ok { glog.Warningf("Number must have suffix: %s", patternStr) return false } valueNumber, valueStr := getNumberAndStringPartsFromPattern(typedValue) if !wildcard.Match(patternStr, valueStr) { glog.Warningf("Suffix %s has not passed wildcard check: %s", valueStr, patternStr) return false } return validateNumber(valueNumber, patternNumber, operator) } return validateNumber(value, patternNumber, operator) } // validateNumber compares two numbers with operator func validateNumber(value, pattern interface{}, operator Operator) bool { floatPattern, err := convertToFloat(pattern) if err != nil { return false } floatValue, err := convertToFloat(value) if err != nil { return false } switch operator { case Equal: return floatValue == floatPattern case NotEqual: return floatValue != floatPattern case More: return floatValue > floatPattern case MoreEqual: return floatValue >= floatPattern case Less: return floatValue < floatPattern case LessEqual: return floatValue <= floatPattern } return false } // getOperatorFromStringPattern parses opeartor from pattern func getOperatorFromStringPattern(pattern string) Operator { if len(pattern) < 2 { return Equal } if pattern[:len(MoreEqual)] == string(MoreEqual) { return MoreEqual } if pattern[:len(LessEqual)] == string(LessEqual) { return LessEqual } if pattern[:len(More)] == string(More) { return More } if pattern[:len(Less)] == string(Less) { return Less } if pattern[:len(NotEqual)] == string(NotEqual) { return NotEqual } return Equal } // detects numerical and string parts in pattern and returns them func getNumberAndStringPartsFromPattern(pattern string) (number, str string) { regexpStr := `^(\d*(\.\d+)?)(.*)` re := regexp.MustCompile(regexpStr) matches := re.FindAllStringSubmatch(pattern, -1) match := matches[0] return match[1], match[3] }
pkg/engine/pattern.go
0.535827
0.401189
pattern.go
starcoder
package processor import ( "encoding/json" "reflect" "strconv" ) const ( stringType = "string" ) // EventAggregator summarizes a set of events. type EventAggregator struct { // CriticalPercent is the threshold percent of events that contain a given property, under which a property will be ommitted from the event summary. CriticalPercent float64 // TotalRows is a count of events seen. TotalRows int // Columns stores information about each property contained within the event.. Columns map[string]*TypeAggregator } // TypeAggregator counts values of potentially many different types. type TypeAggregator struct { Total int Counts map[string]*TypeCounter } // TypeCounter counts occurrences of a specific type. type TypeCounter struct { Type reflect.Type Count int LenEstimator LengthEstimator } // NewEventAggregator allocates a new EventAggregator. func NewEventAggregator(criticalPercentage float64) *EventAggregator { return &EventAggregator{ CriticalPercent: criticalPercentage, Columns: make(map[string]*TypeAggregator), } } // NewTypeAggregator allocates a new TypeAggregator. func NewTypeAggregator() *TypeAggregator { return &TypeAggregator{ Counts: make(map[string]*TypeCounter), } } // Aggregate JSON objects. func (e *EventAggregator) Aggregate(properties map[string]interface{}) { for columnName, val := range properties { _, ok := e.Columns[columnName] if !ok { e.Columns[columnName] = NewTypeAggregator() } e.Columns[columnName].Aggregate(val) } e.TotalRows++ } // Summarize returns a summary of the properties seen for this set of events, as well as a count of number of events seen. // It prunes any property that didn't occur in over CriticalPercent of events. func (e *EventAggregator) Summarize() (int, []PropertySummary) { var aggregatedTypes []PropertySummary for columnName, aggregator := range e.Columns { if e.ColumnShouldBePruned(aggregator) || aggregator.Total < 1 { continue } ps := aggregator.Summarize() ps.Name = columnName ps.OccurrenceProbability = float64(aggregator.Total) / float64(e.TotalRows) aggregatedTypes = append(aggregatedTypes, ps) } return e.TotalRows, aggregatedTypes } // ColumnShouldBePruned returns whether a property seen in set of events should be ignored. func (e *EventAggregator) ColumnShouldBePruned(colAggregate *TypeAggregator) bool { return (float64(colAggregate.Total) / float64(e.TotalRows) * 100) < e.CriticalPercent } // Aggregate decoded JSON values. Converts json.Number to int or float. func (t *TypeAggregator) Aggregate(val interface{}) { typ := reflect.TypeOf(val) if typ == nil { return } if typ.Name() == "Number" { // coerce into float or int typ = coerceJSONNumberToFloatOrInt(val.(json.Number)) } _, ok := t.Counts[typ.Name()] if !ok { switch typ.Name() { case stringType: t.Counts[typ.Name()] = &TypeCounter{ Type: typ, LenEstimator: LengthEstimator{}, } default: t.Counts[typ.Name()] = &TypeCounter{ Type: typ, } } } t.Counts[typ.Name()].Aggregate(val) t.Total++ } func coerceJSONNumberToFloatOrInt(n json.Number) reflect.Type { i, err := n.Int64() if err == nil && strconv.Itoa(int(i)) == n.String() { return reflect.TypeOf(int(i)) } return reflect.TypeOf(123.2) } // Summarize returns the summary for the type that occurred the most. func (t *TypeAggregator) Summarize() PropertySummary { max := &TypeCounter{ Count: -1, } for _, counter := range t.Counts { if counter.Count > max.Count { max = counter } } return max.Summarize() } // Aggregate Go values of a single type. For strings, will store lengths of all strings for estimating 99th percentile. func (c *TypeCounter) Aggregate(val interface{}) { if c.Type.Name() == stringType { s := val.(string) c.LenEstimator.Increment(len(s)) } c.Count++ } // Summarize values that have been aggregated. func (c *TypeCounter) Summarize() PropertySummary { if c.Type.Name() == stringType { return PropertySummary{ T: c.Type, Len: c.LenEstimator.Estimate(), } } return PropertySummary{ T: c.Type, } }
schema_suggestor/processor/event_aggregator.go
0.697197
0.495972
event_aggregator.go
starcoder
package main import ( "math" ) // V4 represents a 4-dimensional (or homogeneous 3-dimensional) vector. type V4 struct { x, y, z, w float64 } func NewV4(x float64, y float64, z float64) *V4 { return &V4{x: x, y: y, z: z, w: 1} } // Length returns the length or magnitude of this vector. func (v *V4) Length() float64 { return math.Sqrt(Dot(*v, *v)) } // Normalize normalizes this vector and returns itself. func (v *V4) Normalize() *V4 { l := v.Length() if l > 0 { v.x /= l v.y /= l v.z /= l } return v } // Add adds the specified vector to this vector and returns a new vector. func (v *V4) Add(v2 *V4) V4 { return V4{ x: v.x + v2.x, y: v.y + v2.y, z: v.z + v2.z, w: v.w, } } // Subtract subtracts the specified vector from this vector (v - v2) and returns a new vector. func (v *V4) Subtract(v2 V4) V4 { return V4{ x: v.x - v2.x, y: v.y - v2.y, z: v.z - v2.z, w: v.w, } } // MultiplyV multiplies this vector by the specified vector and returns itself. func (v *V4) MultiplyV(v2 *V4) *V4 { v.x, v.y, v.z = v.x * v2.x, v.y * v2.y, v.z * v2.z return v } func (v *V4) MultiplyM(m *M4) *V4 { // Multiplies this vector with the specified matrix and returns itself. v.x, v.y, v.z, v.w = v.x * m.a0 + v.y * m.a1 + v.z * m.a2 + v.w * m.a3, v.x * m.b0 + v.y * m.b1 + v.z * m.b2 + v.w * m.b3, v.x * m.c0 + v.y * m.c1 + v.z * m.c2 + v.w * m.c3, v.x * m.d0 + v.y * m.d1 + v.z * m.d2 + v.w * m.d3 return v } func Cross(v1 V4, v2 V4) V4 { // Computes the cross product of the specified matrices. return V4{ x: v1.y * v2.z - v1.z * v2.y, y: v1.z * v2.x - v1.x * v2.z, z: v1.x * v2.y - v1.y * v2.x, w: 1, } } func Dot(v1 V4, v2 V4) float64 { return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z } // Angle returns the angle in radians between the given vectors. func Angle(v1 V4, v2 V4) float64 { v := Dot(v1, v2) / (v1.Length() * v2.Length()) // Squash floating point rounding errors on parallel vectors if v > 1. { v = 1. } else if v < -1. { v = -1. } return math.Acos(v) } // V2 represents a 2-dimensional vector. type V2 struct { x, y float64 } // M4 represents a 4-dimensional matrix. type M4 struct { a0, a1, a2, a3 float64 b0, b1, b2, b3 float64 c0, c1, c2, c3 float64 d0, d1, d2, d3 float64 } // SetIdentity turns this matrix into the identity matrix. func (m *M4) SetIdentity() *M4 { m.a0, m.a1, m.a2, m.a3 = 1, 0, 0, 0 m.b0, m.b1, m.b2, m.b3 = 0, 1, 0, 0 m.c0, m.c1, m.c2, m.c3 = 0, 0, 1, 0 m.d0, m.d1, m.d2, m.d3 = 0, 0, 0, 1 return m } func (m *M4) Mul(m2 *M4) *M4 { // Multiplies this matrix with the specified matrix. a0 := m.a0 * m2.a0 + m.a1 * m2.b0 + m.a2 * m2.c0 + m.a3 * m2.d0 a1 := m.a0 * m2.a1 + m.a1 * m2.b1 + m.a2 * m2.c1 + m.a3 * m2.d1 a2 := m.a0 * m2.a2 + m.a1 * m2.b2 + m.a2 * m2.c2 + m.a3 * m2.d2 a3 := m.a0 * m2.a3 + m.a1 * m2.b3 + m.a2 * m2.c3 + m.a3 * m2.d3 b0 := m.b0 * m2.a0 + m.b1 * m2.b0 + m.b2 * m2.c0 + m.b3 * m2.d0 b1 := m.b0 * m2.a1 + m.b1 * m2.b1 + m.b2 * m2.c1 + m.b3 * m2.d1 b2 := m.b0 * m2.a2 + m.b1 * m2.b2 + m.b2 * m2.c2 + m.b3 * m2.d2 b3 := m.b0 * m2.a3 + m.b1 * m2.b3 + m.b2 * m2.c3 + m.b3 * m2.d3 c0 := m.c0 * m2.a0 + m.c1 * m2.b0 + m.c2 * m2.c0 + m.c3 * m2.d0 c1 := m.c0 * m2.a1 + m.c1 * m2.b1 + m.c2 * m2.c1 + m.c3 * m2.d1 c2 := m.c0 * m2.a2 + m.c1 * m2.b2 + m.c2 * m2.c2 + m.c3 * m2.d2 c3 := m.c0 * m2.a3 + m.c1 * m2.b3 + m.c2 * m2.c3 + m.c3 * m2.d3 d0 := m.d0 * m2.a0 + m.d1 * m2.b0 + m.d2 * m2.c0 + m.d3 * m2.d0 d1 := m.d0 * m2.a1 + m.d1 * m2.b1 + m.d2 * m2.c1 + m.d3 * m2.d1 d2 := m.d0 * m2.a2 + m.d1 * m2.b2 + m.d2 * m2.c2 + m.d3 * m2.d2 d3 := m.d0 * m2.a3 + m.d1 * m2.b3 + m.d2 * m2.c3 + m.d3 * m2.d3 m.a0, m.a1, m.a2, m.a3 = a0, a1, a2, a3 m.b0, m.b1, m.b2, m.b3 = b0, b1, b2, b3 m.c0, m.c1, m.c2, m.c3 = c0, c1, c2, c3 m.d0, m.d1, m.d2, m.d3 = d0, d1, d2, d3 return m } // Transpose returns a new matrix containing the transposition of this matrix. func (m *M4) Transpose() *M4 { return &M4{ m.a0, m.b0, m.c0, m.d0, m.a1, m.b1, m.c1, m.d1, m.a2, m.b2, m.c2, m.d2, m.a3, m.b3, m.c3, m.d3, } } func (m *M4) Determinant() float64 { // http://cg.info.hiroshima-cu.ac.jp/~miyazaki/knowledge/teche23.html return m.a0*m.b1*m.c2*m.d3 + m.a0*m.b2*m.c3*m.d1 + m.a0*m.b3*m.c1*m.d2 + m.a1*m.b0*m.c3*m.d2 + m.a1*m.b2*m.c0*m.d3 + m.a1*m.b3*m.c2*m.d0 + m.a2*m.b0*m.c1*m.d3 + m.a2*m.b1*m.c3*m.d0 + m.a2*m.b3*m.c0*m.d1 + m.a3*m.b0*m.c2*m.d1 + m.a3*m.b1*m.c0*m.d2 + m.a3*m.b2*m.c1*m.d0 - m.a0*m.b1*m.c3*m.d2 - m.a0*m.b2*m.c1*m.d3 - m.a0*m.b3*m.c2*m.d1 - m.a1*m.b0*m.c2*m.d3 - m.a1*m.b2*m.c3*m.d0 - m.a1*m.b3*m.c0*m.d2 - m.a2*m.b0*m.c3*m.d1 - m.a2*m.b1*m.c0*m.d3 - m.a2*m.b3*m.c1*m.d0 - m.a3*m.b0*m.c1*m.d2 - m.a3*m.b1*m.c2*m.d0 - m.a3*m.b2*m.c0*m.d1 } // Inverse returns a new matrix containing the inverse of this matrix. func (m *M4) Inverse() *M4 { // http://cg.info.hiroshima-cu.ac.jp/~miyazaki/knowledge/teche23.html det := m.Determinant() return &M4{ a0: (m.b1*m.c2*m.d3 + m.b2*m.c3*m.d1 + m.b3*m.c1*m.d2 - m.b1*m.c3*m.d2 - m.b2*m.c1*m.d3 - m.b3*m.c2*m.d1) / det, a1: (m.a1*m.c3*m.d2 + m.a2*m.c1*m.d3 + m.a3*m.c2*m.d1 - m.a1*m.c2*m.d3 - m.a2*m.c3*m.d1 - m.a3*m.c1*m.d2) / det, a2: (m.a1*m.b2*m.d3 + m.a2*m.b3*m.d1 + m.a3*m.b1*m.d2 - m.a1*m.b3*m.d2 - m.a2*m.b1*m.d3 - m.a3*m.b2*m.d1) / det, a3: (m.a1*m.b3*m.c2 + m.a2*m.b1*m.c3 + m.a3*m.b2*m.c1 - m.a1*m.b2*m.c3 - m.a2*m.b3*m.c1 - m.a3*m.b1*m.c2) / det, b0: (m.b0*m.c3*m.d2 + m.b2*m.c0*m.d3 + m.b3*m.c2*m.d0 - m.b0*m.c2*m.d3 - m.b2*m.c3*m.d0 - m.b3*m.c0*m.d2) / det, b1: (m.a0*m.c2*m.d3 + m.a2*m.c3*m.d0 + m.a3*m.c0*m.d2 - m.a0*m.c3*m.d2 - m.a2*m.c0*m.d3 - m.a3*m.c2*m.d0) / det, b2: (m.a0*m.b3*m.d2 + m.a2*m.b0*m.d3 + m.a3*m.b2*m.d0 - m.a0*m.b2*m.d3 - m.a2*m.b3*m.d0 - m.a3*m.b0*m.d2) / det, b3: (m.a0*m.b2*m.c3 + m.a2*m.b3*m.c0 + m.a3*m.b0*m.c2 - m.a0*m.b3*m.c2 - m.a2*m.b0*m.c3 - m.a3*m.b2*m.c0) / det, c0: (m.b0*m.c1*m.d3 + m.b1*m.c3*m.d0 + m.b3*m.c0*m.d1 - m.b0*m.c3*m.d1 - m.b1*m.c0*m.d3 - m.b3*m.c1*m.d0) / det, c1: (m.a0*m.c3*m.d1 + m.a1*m.c0*m.d3 + m.a3*m.c1*m.d0 - m.a0*m.c1*m.d3 - m.a1*m.c3*m.d0 - m.a3*m.c0*m.d1) / det, c2: (m.a0*m.b1*m.d3 + m.a1*m.b3*m.d0 + m.a3*m.b0*m.d1 - m.a0*m.b3*m.d1 - m.a1*m.b0*m.d3 - m.a3*m.b1*m.d0) / det, c3: (m.a0*m.b3*m.c1 + m.a1*m.b0*m.c3 + m.a3*m.b1*m.c0 - m.a0*m.b1*m.c3 - m.a1*m.b3*m.c0 - m.a3*m.b0*m.c1) / det, d0: (m.b0*m.c2*m.d1 + m.b1*m.c0*m.d2 + m.b2*m.c1*m.d0 - m.b0*m.c1*m.d2 - m.b1*m.c2*m.d0 - m.b2*m.c0*m.d1) / det, d1: (m.a0*m.c1*m.d2 + m.a1*m.c2*m.d0 + m.a2*m.c0*m.d1 - m.a0*m.c2*m.d1 - m.a1*m.c0*m.d2 - m.a2*m.c1*m.d0) / det, d2: (m.a0*m.b2*m.d1 + m.a1*m.b0*m.d2 + m.a2*m.b1*m.d0 - m.a0*m.b1*m.d2 - m.a1*m.b2*m.d0 - m.a2*m.b0*m.d1) / det, d3: (m.a0*m.b1*m.c2 + m.a1*m.b2*m.c0 + m.a2*m.b0*m.c1 - m.a0*m.b2*m.c1 - m.a1*m.b0*m.c2 - m.a2*m.b1*m.c0) / det, } } type Triangle struct { // A single triangle, consisting of 3 vertices. v1, v2, v3 V4 } func NewTriangle(points ...float64) *Triangle { return &Triangle{ *NewV4(points[0], points[1], points[2]), *NewV4(points[3], points[4], points[5]), *NewV4(points[6], points[7], points[8])} } func (t Triangle) Clone() *Triangle { return &t } func (t *Triangle) Apply(m *M4) *Triangle { // Applies the specified transformation matrix to this triangle and returns itself. t.v1.MultiplyM(m) t.v2.MultiplyM(m) t.v3.MultiplyM(m) return t } func (t *Triangle) Normal() V4 { // Computes the triangle's normal vector. // The direction of the normal follows the triangle's winding direction: // counter-clockwise winding produces positive (z) normal, clockwise winding // produces negative (z) normals. v1 := t.v2.Subtract(t.v1) v2 := t.v3.Subtract(t.v1) return Cross(v1, v2) } type Model struct { // A model contains zero or more triangles. triangles []Triangle } func (m Model) Clone() *Model { m2 := Model{make([]Triangle, len(m.triangles))} for i, v := range m.triangles { m2.triangles[i] = v } return &m2 } // Merge creates a new model that consist of the combination of this model and the supplied one. func (m *Model) Merge(models ...Model) *Model { polys := len(m.triangles) for _, mod := range models { polys += len(mod.triangles) } m3 := Model{make([]Triangle, polys)} i := 0 for _, mod := range append([]Model{*m}, models...) { for _, v := range mod.triangles { m3.triangles[i] = v i++ } } return &m3 } // Apply applies the specified transformation matrix to this model and returns itself. func (m *Model) Apply(mat *M4) *Model { for i := 0; i < len(m.triangles); i++ { m.triangles[i].Apply(mat) } return m } func (m *Model) Move(x float64, y float64, z float64) *Model { // Translates the model. return m.Apply(TransM(NewV4(x, y, z))) } func (m *Model) Rot(ax float64, ay float64, az float64) *Model { // Rotates the model along the specified angles (in radians). return m.Apply(RotX(ax).Mul(RotY(ay).Mul(RotZ(az)))) } func ScaleM(x float64, y float64, z float64) *M4 { // Creates a new scaling matrix with the specified magnitudes. return &M4{ x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1} } func TransM(v *V4) *M4 { // Creates a new translation matrix along the specified vector. return &M4{ 1, 0, 0, v.x, 0, 1, 0, v.y, 0, 0, 1, v.z, 0, 0, 0, 1} } func RotX(a float64) *M4 { // Creates a new rotation matrix along the x-axis, with the specified angle in radians. return &M4{ 1, 0, 0, 0, 0, math.Cos(a), -math.Sin(a), 0, 0, math.Sin(a), math.Cos(a), 0, 0, 0, 0, 1} } func RotY(a float64) *M4 { // Creates a new rotation matrix along the y-axis, with the specified angle in radians. return &M4{ math.Cos(a), 0, math.Sin(a), 0, 0, 1, 0, 0, -math.Sin(a), 0, math.Cos(a), 0, 0, 0, 0, 1} } // RotZ creates a new rotation matrix along the z-axis, with the specified angle in radians. func RotZ(a float64) *M4 { return &M4{ math.Cos(a), -math.Sin(a), 0, 0, math.Sin(a), math.Cos(a), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1} } // Rot returns a rotation matrix that when applied to a vector, rotates the // vector about the line through point `p` with direction vector `v` by the // specified angle in radians. func Rot(p *V4, v *V4, phi float64) *M4 { // https://sites.google.com/site/glennmurray/Home/rotation-matrices-and-formulas // Normalize the direction vector: l := v.Length() if l <= 0 { panic("Cannot rotate around vector of length zero") } x := v.x / l y := v.y / l z := v.z / l // Precompute intermediate values: x2 := x * x y2 := y * y z2 := z * z sp := math.Sin(phi) cp := math.Cos(phi) omcp := 1. - cp return &M4{ a0: x2 + (y2 + z2) * cp, a1: x * y * omcp - z * sp, a2: x * z * omcp + y * sp, a3: (p.x * (y2 + z2) - x * (p.y * y + p.z * z)) * omcp + (p.y * z - p.z * y) * sp, b0: x * y * omcp + z * sp, b1: y2 + (x2 + z2) * cp, b2: y * z * omcp - x * sp, b3: (p.y * (x2 + z2) - y * (p.x * x + p.z * z)) * omcp + (p.z * x - p.x * z) * sp, c0: x * z * omcp - y * sp, c1: y * z * omcp + x * sp, c2: z2 + (x2 + y2) * cp, c3: (p.z * (x2 + y2) - z * (p.x * x + p.y * y)) * omcp + (p.x * y - p.y * x) * sp, d0: 0, d1: 0, d2: 0, d3: 1, } }
matrix.go
0.89306
0.593963
matrix.go
starcoder
package sqrt import ( "math/big" ) // sqrtLittleSquaresBigInt is the original algorithm trying to deal with integer overflows // caused by the increasing/recursive behavior of the algorithm that requires getting the // square root of larger and larger integers. // Since big numbers allocate memory, this algorithm is the one that performs the worst, // but it's way more precise while keeping the same "only integers" constraint. func sqrtLittleSquaresBigInt(n *big.Int) *big.Float { ret := (&big.Float{}).SetPrec(fpPrec) closest := closestBigInt(n) b, c := &big.Int{}, &big.Int{} x := quadraticEqBigInt(b.Mul(closest, bigMinusTwo), c.Mul(closest, closest).Sub(c, n)) return ret.SetInt(closest).Sub(ret, x) } var bigFour = big.NewInt(4) var bigTwo = big.NewInt(2) var bigMinusTwo = big.NewInt(-2) var bigMinusOneFloat = big.NewFloat(-1) var bigPoint5 = big.NewFloat(0.5) var bigOne = big.NewInt(1) var bigZero = big.NewInt(0) func closestBigInt(n *big.Int) *big.Int { if n.Cmp(bigFour) <= 0 { return bigTwo } low, high, tmp := bigOne, &big.Int{}, &big.Int{} high.Set(n) for tmp.Add(low, bigOne).Cmp(high) < 0 { closest := &big.Int{} closest.Add(low, high) closest.Div(closest, bigTwo) squared := &big.Int{} squared.Mul(closest, closest) switch cmp := squared.Cmp(n); { case cmp == 0: return closest case cmp < 0: low = closest case cmp > 0: high = closest } } return high } var precisionBig = big.NewFloat(precision / 1000000000) const fpPrec = 50 // ( -b - sqrt(b²-4ac) ) / (2a) func quadraticEqBigInt(b, c *big.Int) *big.Float { diff, disc := &big.Int{}, &big.Int{} diff.Mul(bigFour, c) disc = disc.Mul(b, b).Sub(disc, diff) p := (&big.Float{}).SetPrec(fpPrec) p.Quo((&big.Float{}).SetInt(diff), (&big.Float{}).SetInt(disc)) if cmp := p.Cmp(precisionBig); cmp < 0 { return p } discSqrt := sqrtLittleSquaresBigInt(disc) ret := (&big.Float{}).SetPrec(fpPrec) return ret.SetInt(b.Neg(b)).Sub(ret, discSqrt).Mul(ret, bigPoint5) }
sqrt_by_hand_using_big_number.go
0.793266
0.513912
sqrt_by_hand_using_big_number.go
starcoder
package merkletree import ( "crypto" "encoding/binary" "fmt" ) // PathElement is a single element within a path. type PathElement struct { IsLeaf bool // Is this node a leaf? IsLeft bool // Is the left child of its father. Depths uint32 // Depths to this node. Hash []byte // Hash of content. IsEmpty bool // Is this an empty node. } func (pe *PathElement) String() string { var empty, leaf, left string if pe.IsLeaf { leaf = "leaf " } if pe.IsEmpty { empty = "empty " } if pe.IsLeft { left = "left" } else { left = "right" } return fmt.Sprintf("%s%s%s %d %x", empty, leaf, left, pe.Depths, pe.Hash) } // prefix generates the prefix for the path element. func (pe *PathElement) prefix() []byte { pr := make([]byte, 1+1+1+4) // IsLeaf IsLeft uint32 depths if pe.IsLeaf { pr[0] = 0x01 } if pe.IsLeft { pr[1] = 0x01 } if pe.IsEmpty { pr[2] = 0x01 } binary.BigEndian.PutUint32(pr[3:], uint32(pe.Depths)) return pr } // CalcHashFromNodes calculates a new parent node hash from left and right node. func (pe *PathElement) CalcHashFromNodes(hash crypto.Hash, leftNode, rightNode *PathElement) { pe.CalcHash(hash, leftNode.Hash, rightNode.Hash) } // CalcHash calculates the Hash field of a PathElement from left and right children, // both of which could be nil. The input uses 0x00 as prefix and postfix for the data // to be hashed, and separates left and right by 0x00. Furthermore it includes // the prefix of the PathElement which encodes Leaf/Interrior, Depths and Left/Right // position. func (pe *PathElement) CalcHash(hash crypto.Hash, leftNodeHash, rightNodeHash []byte) { h := hash.New() h.Write([]byte{0x00}) if leftNodeHash != nil { h.Write(leftNodeHash) } if leftNodeHash != nil && rightNodeHash != nil { h.Write([]byte{0x00}) } if rightNodeHash != nil { h.Write(rightNodeHash) } h.Write([]byte{0x00}) pe.Hash = h.Sum(pe.prefix()) } // CalcHashLeaf calculates the Hash field for a leaf. func (pe *PathElement) CalcHashLeaf(hash crypto.Hash, leafContent []byte) { pe.CalcHash(hash, leafContent, nil) } // Path is the path to a leaf, including the leaf itself. type Path []*PathElement // ParentPathElement creates a new parent from two children. func ParentPathElement(isLeft bool, leftNode, rightNode *PathElement, hash crypto.Hash) *PathElement { if leftNode.Depths != rightNode.Depths { panic("Cannot create a parent to children of different depths. Programming error!") } np := &PathElement{ IsLeaf: false, // This is always an interior node. IsLeft: isLeft, Depths: leftNode.Depths - 1, IsEmpty: false, // Parent nodes can't be empty because they have at least one child. } np.CalcHashFromNodes(hash, leftNode, rightNode) return np } // newParent creates a new parent node from left and right and writes it to the writePosition. func (tc *treeCache) newParent(leftNode, rightNode *PathElement, writePos int) { // Write PathElement to cache tc.nodeCache[writePos] = ParentPathElement((writePos%2 == 0), leftNode, rightNode, tc.hash) } // Compress a path by removing empty elements which can be inferred. func (p Path) Compress() Path { r := make(Path, 0, len(p)) for _, e := range p { if !e.IsEmpty { r = append(r, e) } } return r } // GetRoot returns true and the root from a path. False and nil if it has no root. func (p Path) GetRoot() (root *PathElement, ok bool) { root = p[len(p)-1] if root.IsLeaf { return nil, false } if root.Depths != 0 { return nil, false } return root, true } func (p *PathElement) RootHash(hash crypto.Hash) []byte { h := hash.New() h.Write(p.Hash) return h.Sum(make([]byte, 0)) }
merkletree/path.go
0.68342
0.46223
path.go
starcoder
package sexpconv import ( "go/ast" "go/token" "sexp" "xast" ) func (conv *converter) Stmt(node ast.Stmt) sexp.Form { switch node := node.(type) { case *ast.IfStmt: return conv.IfStmt(node) case *ast.ReturnStmt: return conv.ReturnStmt(node) case *ast.BlockStmt: return conv.BlockStmt(node) case *ast.DeclStmt: return conv.DeclStmt(node) case *ast.AssignStmt: return conv.AssignStmt(node) case *ast.IncDecStmt: return conv.IncDecStmt(node) case *ast.ExprStmt: return conv.ExprStmt(node) case *ast.ForStmt: return conv.ForStmt(node) case *ast.RangeStmt: return conv.RangeStmt(node) case *ast.SwitchStmt: return conv.SwitchStmt(node) case *ast.BranchStmt: return conv.BranchStmt(node) case *ast.LabeledStmt: return conv.LabeledStmt(node) case *ast.EmptyStmt: return sexp.EmptyForm default: panic(errUnexpectedStmt(conv, node)) } } func (conv *converter) IfStmt(node *ast.IfStmt) sexp.Form { test := conv.Expr(node.Cond) then := conv.BlockStmt(node.Body) form := &sexp.If{Cond: test, Then: then} if node.Else == nil { form.Else = sexp.EmptyForm } else { form.Else = conv.Stmt(node.Else) } return conv.withInitStmt(node.Init, form) } // Used to complement statement with init SimpleStmt // (switch and if statements). func (conv *converter) withInitStmt(init ast.Stmt, form sexp.Form) sexp.Form { switch init := init.(type) { case nil: return form case *ast.AssignStmt: assigns := toFormList(conv.AssignStmt(init)) return sexp.Block(append(assigns, form)) default: return sexp.FormList([]sexp.Form{conv.Stmt(init), form}) } } func (conv *converter) ReturnStmt(node *ast.ReturnStmt) *sexp.Return { // #FIXME: will not work for "naked" returns. results := make([]sexp.Form, len(node.Results)) for i, node := range node.Results { typ := conv.retType.At(i).Type() conv.ctxType = typ results[i] = conv.copyValue(conv.Expr(node), typ) } return &sexp.Return{Results: results} } func (conv *converter) BlockStmt(node *ast.BlockStmt) sexp.Block { return sexp.Block(conv.stmtList(node.List)) } func (conv *converter) DeclStmt(node *ast.DeclStmt) sexp.Form { decl := node.Decl.(*ast.GenDecl) switch decl.Tok { case token.VAR: return conv.varDecl(decl) } panic(errUnexpectedStmt(conv, node)) } func (conv *converter) varDecl(node *ast.GenDecl) sexp.FormList { forms := make([]sexp.Form, 0, 1) for _, spec := range node.Specs { forms = conv.valueSpec(forms, spec.(*ast.ValueSpec)) } return sexp.FormList(forms) } func (conv *converter) valueSpec(forms []sexp.Form, spec *ast.ValueSpec) []sexp.Form { if len(spec.Values) == 0 { zv := ZeroValue(conv.typeOf(spec.Type)) for _, ident := range spec.Names { if ident.Name != "_" { forms = append(forms, &sexp.Bind{Name: ident.Name, Init: zv}) } } } else { lhs := xast.ExprSlice(spec.Names) forms = append(forms, conv.genAssign(lhs, spec.Values)) } return forms } func (conv *converter) IncDecStmt(node *ast.IncDecStmt) sexp.Form { target := node.X.(*ast.Ident) // #FIXME: should be any "addressable". if node.Tok == token.INC { return &sexp.Rebind{ Name: target.Name, Expr: sexp.NewAdd1(conv.Expr(target)), } } return &sexp.Rebind{ Name: target.Name, Expr: sexp.NewSub1(conv.Expr(target)), } } func (conv *converter) ExprStmt(node *ast.ExprStmt) sexp.Form { return &sexp.ExprStmt{Expr: conv.Expr(node.X)} }
src/sexpconv/stmt.go
0.504639
0.438545
stmt.go
starcoder
package asm func (o Opcodes) Aad(ops ...Operand) { o.a.op("AAD", ops...) } func (o Opcodes) AAD(ops ...Operand) { o.a.op("AAD", ops...) } func (o Opcodes) Aam(ops ...Operand) { o.a.op("AAM", ops...) } func (o Opcodes) AAM(ops ...Operand) { o.a.op("AAM", ops...) } func (o Opcodes) Aas(ops ...Operand) { o.a.op("AAS", ops...) } func (o Opcodes) AAS(ops ...Operand) { o.a.op("AAS", ops...) } func (o Opcodes) Adcb(ops ...Operand) { o.a.op("ADCB", ops...) } func (o Opcodes) ADCB(ops ...Operand) { o.a.op("ADCB", ops...) } func (o Opcodes) Adcl(ops ...Operand) { o.a.op("ADCL", ops...) } func (o Opcodes) ADCL(ops ...Operand) { o.a.op("ADCL", ops...) } func (o Opcodes) Adcq(ops ...Operand) { o.a.op("ADCQ", ops...) } func (o Opcodes) ADCQ(ops ...Operand) { o.a.op("ADCQ", ops...) } func (o Opcodes) Adcw(ops ...Operand) { o.a.op("ADCW", ops...) } func (o Opcodes) ADCW(ops ...Operand) { o.a.op("ADCW", ops...) } func (o Opcodes) Adcxl(ops ...Operand) { o.a.op("ADCXL", ops...) } func (o Opcodes) ADCXL(ops ...Operand) { o.a.op("ADCXL", ops...) } func (o Opcodes) Adcxq(ops ...Operand) { o.a.op("ADCXQ", ops...) } func (o Opcodes) ADCXQ(ops ...Operand) { o.a.op("ADCXQ", ops...) } func (o Opcodes) Addb(ops ...Operand) { o.a.op("ADDB", ops...) } func (o Opcodes) ADDB(ops ...Operand) { o.a.op("ADDB", ops...) } func (o Opcodes) Addl(ops ...Operand) { o.a.op("ADDL", ops...) } func (o Opcodes) ADDL(ops ...Operand) { o.a.op("ADDL", ops...) } func (o Opcodes) Addpd(ops ...Operand) { o.a.op("ADDPD", ops...) } func (o Opcodes) ADDPD(ops ...Operand) { o.a.op("ADDPD", ops...) } func (o Opcodes) Addps(ops ...Operand) { o.a.op("ADDPS", ops...) } func (o Opcodes) ADDPS(ops ...Operand) { o.a.op("ADDPS", ops...) } func (o Opcodes) Addq(ops ...Operand) { o.a.op("ADDQ", ops...) } func (o Opcodes) ADDQ(ops ...Operand) { o.a.op("ADDQ", ops...) } func (o Opcodes) Addsd(ops ...Operand) { o.a.op("ADDSD", ops...) } func (o Opcodes) ADDSD(ops ...Operand) { o.a.op("ADDSD", ops...) } func (o Opcodes) Addss(ops ...Operand) { o.a.op("ADDSS", ops...) } func (o Opcodes) ADDSS(ops ...Operand) { o.a.op("ADDSS", ops...) } func (o Opcodes) Addsubpd(ops ...Operand) { o.a.op("ADDSUBPD", ops...) } func (o Opcodes) ADDSUBPD(ops ...Operand) { o.a.op("ADDSUBPD", ops...) } func (o Opcodes) Addsubps(ops ...Operand) { o.a.op("ADDSUBPS", ops...) } func (o Opcodes) ADDSUBPS(ops ...Operand) { o.a.op("ADDSUBPS", ops...) } func (o Opcodes) Addw(ops ...Operand) { o.a.op("ADDW", ops...) } func (o Opcodes) ADDW(ops ...Operand) { o.a.op("ADDW", ops...) } func (o Opcodes) Adjsp(ops ...Operand) { o.a.op("ADJSP", ops...) } func (o Opcodes) ADJSP(ops ...Operand) { o.a.op("ADJSP", ops...) } func (o Opcodes) Adoxl(ops ...Operand) { o.a.op("ADOXL", ops...) } func (o Opcodes) ADOXL(ops ...Operand) { o.a.op("ADOXL", ops...) } func (o Opcodes) Adoxq(ops ...Operand) { o.a.op("ADOXQ", ops...) } func (o Opcodes) ADOXQ(ops ...Operand) { o.a.op("ADOXQ", ops...) } func (o Opcodes) Aesdec(ops ...Operand) { o.a.op("AESDEC", ops...) } func (o Opcodes) AESDEC(ops ...Operand) { o.a.op("AESDEC", ops...) } func (o Opcodes) Aesdeclast(ops ...Operand) { o.a.op("AESDECLAST", ops...) } func (o Opcodes) AESDECLAST(ops ...Operand) { o.a.op("AESDECLAST", ops...) } func (o Opcodes) Aesenc(ops ...Operand) { o.a.op("AESENC", ops...) } func (o Opcodes) AESENC(ops ...Operand) { o.a.op("AESENC", ops...) } func (o Opcodes) Aesenclast(ops ...Operand) { o.a.op("AESENCLAST", ops...) } func (o Opcodes) AESENCLAST(ops ...Operand) { o.a.op("AESENCLAST", ops...) } func (o Opcodes) Aesimc(ops ...Operand) { o.a.op("AESIMC", ops...) } func (o Opcodes) AESIMC(ops ...Operand) { o.a.op("AESIMC", ops...) } func (o Opcodes) Aeskeygenassist(ops ...Operand) { o.a.op("AESKEYGENASSIST", ops...) } func (o Opcodes) AESKEYGENASSIST(ops ...Operand) { o.a.op("AESKEYGENASSIST", ops...) } func (o Opcodes) Andb(ops ...Operand) { o.a.op("ANDB", ops...) } func (o Opcodes) ANDB(ops ...Operand) { o.a.op("ANDB", ops...) } func (o Opcodes) Andl(ops ...Operand) { o.a.op("ANDL", ops...) } func (o Opcodes) ANDL(ops ...Operand) { o.a.op("ANDL", ops...) } func (o Opcodes) Andnl(ops ...Operand) { o.a.op("ANDNL", ops...) } func (o Opcodes) ANDNL(ops ...Operand) { o.a.op("ANDNL", ops...) } func (o Opcodes) Andnpd(ops ...Operand) { o.a.op("ANDNPD", ops...) } func (o Opcodes) ANDNPD(ops ...Operand) { o.a.op("ANDNPD", ops...) } func (o Opcodes) Andnps(ops ...Operand) { o.a.op("ANDNPS", ops...) } func (o Opcodes) ANDNPS(ops ...Operand) { o.a.op("ANDNPS", ops...) } func (o Opcodes) Andnq(ops ...Operand) { o.a.op("ANDNQ", ops...) } func (o Opcodes) ANDNQ(ops ...Operand) { o.a.op("ANDNQ", ops...) } func (o Opcodes) Andpd(ops ...Operand) { o.a.op("ANDPD", ops...) } func (o Opcodes) ANDPD(ops ...Operand) { o.a.op("ANDPD", ops...) } func (o Opcodes) Andps(ops ...Operand) { o.a.op("ANDPS", ops...) } func (o Opcodes) ANDPS(ops ...Operand) { o.a.op("ANDPS", ops...) } func (o Opcodes) Andq(ops ...Operand) { o.a.op("ANDQ", ops...) } func (o Opcodes) ANDQ(ops ...Operand) { o.a.op("ANDQ", ops...) } func (o Opcodes) Andw(ops ...Operand) { o.a.op("ANDW", ops...) } func (o Opcodes) ANDW(ops ...Operand) { o.a.op("ANDW", ops...) } func (o Opcodes) Arpl(ops ...Operand) { o.a.op("ARPL", ops...) } func (o Opcodes) ARPL(ops ...Operand) { o.a.op("ARPL", ops...) } func (o Opcodes) Bextrl(ops ...Operand) { o.a.op("BEXTRL", ops...) } func (o Opcodes) BEXTRL(ops ...Operand) { o.a.op("BEXTRL", ops...) } func (o Opcodes) Bextrq(ops ...Operand) { o.a.op("BEXTRQ", ops...) } func (o Opcodes) BEXTRQ(ops ...Operand) { o.a.op("BEXTRQ", ops...) } func (o Opcodes) Blendpd(ops ...Operand) { o.a.op("BLENDPD", ops...) } func (o Opcodes) BLENDPD(ops ...Operand) { o.a.op("BLENDPD", ops...) } func (o Opcodes) Blendps(ops ...Operand) { o.a.op("BLENDPS", ops...) } func (o Opcodes) BLENDPS(ops ...Operand) { o.a.op("BLENDPS", ops...) } func (o Opcodes) Blendvpd(ops ...Operand) { o.a.op("BLENDVPD", ops...) } func (o Opcodes) BLENDVPD(ops ...Operand) { o.a.op("BLENDVPD", ops...) } func (o Opcodes) Blendvps(ops ...Operand) { o.a.op("BLENDVPS", ops...) } func (o Opcodes) BLENDVPS(ops ...Operand) { o.a.op("BLENDVPS", ops...) } func (o Opcodes) Blsil(ops ...Operand) { o.a.op("BLSIL", ops...) } func (o Opcodes) BLSIL(ops ...Operand) { o.a.op("BLSIL", ops...) } func (o Opcodes) Blsiq(ops ...Operand) { o.a.op("BLSIQ", ops...) } func (o Opcodes) BLSIQ(ops ...Operand) { o.a.op("BLSIQ", ops...) } func (o Opcodes) Blsmskl(ops ...Operand) { o.a.op("BLSMSKL", ops...) } func (o Opcodes) BLSMSKL(ops ...Operand) { o.a.op("BLSMSKL", ops...) } func (o Opcodes) Blsmskq(ops ...Operand) { o.a.op("BLSMSKQ", ops...) } func (o Opcodes) BLSMSKQ(ops ...Operand) { o.a.op("BLSMSKQ", ops...) } func (o Opcodes) Blsrl(ops ...Operand) { o.a.op("BLSRL", ops...) } func (o Opcodes) BLSRL(ops ...Operand) { o.a.op("BLSRL", ops...) } func (o Opcodes) Blsrq(ops ...Operand) { o.a.op("BLSRQ", ops...) } func (o Opcodes) BLSRQ(ops ...Operand) { o.a.op("BLSRQ", ops...) } func (o Opcodes) Boundl(ops ...Operand) { o.a.op("BOUNDL", ops...) } func (o Opcodes) BOUNDL(ops ...Operand) { o.a.op("BOUNDL", ops...) } func (o Opcodes) Boundw(ops ...Operand) { o.a.op("BOUNDW", ops...) } func (o Opcodes) BOUNDW(ops ...Operand) { o.a.op("BOUNDW", ops...) } func (o Opcodes) Bsfl(ops ...Operand) { o.a.op("BSFL", ops...) } func (o Opcodes) BSFL(ops ...Operand) { o.a.op("BSFL", ops...) } func (o Opcodes) Bsfq(ops ...Operand) { o.a.op("BSFQ", ops...) } func (o Opcodes) BSFQ(ops ...Operand) { o.a.op("BSFQ", ops...) } func (o Opcodes) Bsfw(ops ...Operand) { o.a.op("BSFW", ops...) } func (o Opcodes) BSFW(ops ...Operand) { o.a.op("BSFW", ops...) } func (o Opcodes) Bsrl(ops ...Operand) { o.a.op("BSRL", ops...) } func (o Opcodes) BSRL(ops ...Operand) { o.a.op("BSRL", ops...) } func (o Opcodes) Bsrq(ops ...Operand) { o.a.op("BSRQ", ops...) } func (o Opcodes) BSRQ(ops ...Operand) { o.a.op("BSRQ", ops...) } func (o Opcodes) Bsrw(ops ...Operand) { o.a.op("BSRW", ops...) } func (o Opcodes) BSRW(ops ...Operand) { o.a.op("BSRW", ops...) } func (o Opcodes) Bswapl(ops ...Operand) { o.a.op("BSWAPL", ops...) } func (o Opcodes) BSWAPL(ops ...Operand) { o.a.op("BSWAPL", ops...) } func (o Opcodes) Bswapq(ops ...Operand) { o.a.op("BSWAPQ", ops...) } func (o Opcodes) BSWAPQ(ops ...Operand) { o.a.op("BSWAPQ", ops...) } func (o Opcodes) Bswapw(ops ...Operand) { o.a.op("BSWAPW", ops...) } func (o Opcodes) BSWAPW(ops ...Operand) { o.a.op("BSWAPW", ops...) } func (o Opcodes) Btcl(ops ...Operand) { o.a.op("BTCL", ops...) } func (o Opcodes) BTCL(ops ...Operand) { o.a.op("BTCL", ops...) } func (o Opcodes) Btcq(ops ...Operand) { o.a.op("BTCQ", ops...) } func (o Opcodes) BTCQ(ops ...Operand) { o.a.op("BTCQ", ops...) } func (o Opcodes) Btcw(ops ...Operand) { o.a.op("BTCW", ops...) } func (o Opcodes) BTCW(ops ...Operand) { o.a.op("BTCW", ops...) } func (o Opcodes) Btl(ops ...Operand) { o.a.op("BTL", ops...) } func (o Opcodes) BTL(ops ...Operand) { o.a.op("BTL", ops...) } func (o Opcodes) Btq(ops ...Operand) { o.a.op("BTQ", ops...) } func (o Opcodes) BTQ(ops ...Operand) { o.a.op("BTQ", ops...) } func (o Opcodes) Btrl(ops ...Operand) { o.a.op("BTRL", ops...) } func (o Opcodes) BTRL(ops ...Operand) { o.a.op("BTRL", ops...) } func (o Opcodes) Btrq(ops ...Operand) { o.a.op("BTRQ", ops...) } func (o Opcodes) BTRQ(ops ...Operand) { o.a.op("BTRQ", ops...) } func (o Opcodes) Btrw(ops ...Operand) { o.a.op("BTRW", ops...) } func (o Opcodes) BTRW(ops ...Operand) { o.a.op("BTRW", ops...) } func (o Opcodes) Btsl(ops ...Operand) { o.a.op("BTSL", ops...) } func (o Opcodes) BTSL(ops ...Operand) { o.a.op("BTSL", ops...) } func (o Opcodes) Btsq(ops ...Operand) { o.a.op("BTSQ", ops...) } func (o Opcodes) BTSQ(ops ...Operand) { o.a.op("BTSQ", ops...) } func (o Opcodes) Btsw(ops ...Operand) { o.a.op("BTSW", ops...) } func (o Opcodes) BTSW(ops ...Operand) { o.a.op("BTSW", ops...) } func (o Opcodes) Btw(ops ...Operand) { o.a.op("BTW", ops...) } func (o Opcodes) BTW(ops ...Operand) { o.a.op("BTW", ops...) } func (o Opcodes) Byte(ops ...Operand) { o.a.op("BYTE", ops...) } func (o Opcodes) BYTE(ops ...Operand) { o.a.op("BYTE", ops...) } func (o Opcodes) Bzhil(ops ...Operand) { o.a.op("BZHIL", ops...) } func (o Opcodes) BZHIL(ops ...Operand) { o.a.op("BZHIL", ops...) } func (o Opcodes) Bzhiq(ops ...Operand) { o.a.op("BZHIQ", ops...) } func (o Opcodes) BZHIQ(ops ...Operand) { o.a.op("BZHIQ", ops...) } func (o Opcodes) Cbw(ops ...Operand) { o.a.op("CBW", ops...) } func (o Opcodes) CBW(ops ...Operand) { o.a.op("CBW", ops...) } func (o Opcodes) Cdq(ops ...Operand) { o.a.op("CDQ", ops...) } func (o Opcodes) CDQ(ops ...Operand) { o.a.op("CDQ", ops...) } func (o Opcodes) Cdqe(ops ...Operand) { o.a.op("CDQE", ops...) } func (o Opcodes) CDQE(ops ...Operand) { o.a.op("CDQE", ops...) } func (o Opcodes) Clac(ops ...Operand) { o.a.op("CLAC", ops...) } func (o Opcodes) CLAC(ops ...Operand) { o.a.op("CLAC", ops...) } func (o Opcodes) Clc(ops ...Operand) { o.a.op("CLC", ops...) } func (o Opcodes) CLC(ops ...Operand) { o.a.op("CLC", ops...) } func (o Opcodes) Cld(ops ...Operand) { o.a.op("CLD", ops...) } func (o Opcodes) CLD(ops ...Operand) { o.a.op("CLD", ops...) } func (o Opcodes) Clflush(ops ...Operand) { o.a.op("CLFLUSH", ops...) } func (o Opcodes) CLFLUSH(ops ...Operand) { o.a.op("CLFLUSH", ops...) } func (o Opcodes) Clflushopt(ops ...Operand) { o.a.op("CLFLUSHOPT", ops...) } func (o Opcodes) CLFLUSHOPT(ops ...Operand) { o.a.op("CLFLUSHOPT", ops...) } func (o Opcodes) Cli(ops ...Operand) { o.a.op("CLI", ops...) } func (o Opcodes) CLI(ops ...Operand) { o.a.op("CLI", ops...) } func (o Opcodes) Clts(ops ...Operand) { o.a.op("CLTS", ops...) } func (o Opcodes) CLTS(ops ...Operand) { o.a.op("CLTS", ops...) } func (o Opcodes) Cmc(ops ...Operand) { o.a.op("CMC", ops...) } func (o Opcodes) CMC(ops ...Operand) { o.a.op("CMC", ops...) } func (o Opcodes) Cmovlcc(ops ...Operand) { o.a.op("CMOVLCC", ops...) } func (o Opcodes) CMOVLCC(ops ...Operand) { o.a.op("CMOVLCC", ops...) } func (o Opcodes) Cmovlcs(ops ...Operand) { o.a.op("CMOVLCS", ops...) } func (o Opcodes) CMOVLCS(ops ...Operand) { o.a.op("CMOVLCS", ops...) } func (o Opcodes) Cmovleq(ops ...Operand) { o.a.op("CMOVLEQ", ops...) } func (o Opcodes) CMOVLEQ(ops ...Operand) { o.a.op("CMOVLEQ", ops...) } func (o Opcodes) Cmovlge(ops ...Operand) { o.a.op("CMOVLGE", ops...) } func (o Opcodes) CMOVLGE(ops ...Operand) { o.a.op("CMOVLGE", ops...) } func (o Opcodes) Cmovlgt(ops ...Operand) { o.a.op("CMOVLGT", ops...) } func (o Opcodes) CMOVLGT(ops ...Operand) { o.a.op("CMOVLGT", ops...) } func (o Opcodes) Cmovlhi(ops ...Operand) { o.a.op("CMOVLHI", ops...) } func (o Opcodes) CMOVLHI(ops ...Operand) { o.a.op("CMOVLHI", ops...) } func (o Opcodes) Cmovlle(ops ...Operand) { o.a.op("CMOVLLE", ops...) } func (o Opcodes) CMOVLLE(ops ...Operand) { o.a.op("CMOVLLE", ops...) } func (o Opcodes) Cmovlls(ops ...Operand) { o.a.op("CMOVLLS", ops...) } func (o Opcodes) CMOVLLS(ops ...Operand) { o.a.op("CMOVLLS", ops...) } func (o Opcodes) Cmovllt(ops ...Operand) { o.a.op("CMOVLLT", ops...) } func (o Opcodes) CMOVLLT(ops ...Operand) { o.a.op("CMOVLLT", ops...) } func (o Opcodes) Cmovlmi(ops ...Operand) { o.a.op("CMOVLMI", ops...) } func (o Opcodes) CMOVLMI(ops ...Operand) { o.a.op("CMOVLMI", ops...) } func (o Opcodes) Cmovlne(ops ...Operand) { o.a.op("CMOVLNE", ops...) } func (o Opcodes) CMOVLNE(ops ...Operand) { o.a.op("CMOVLNE", ops...) } func (o Opcodes) Cmovloc(ops ...Operand) { o.a.op("CMOVLOC", ops...) } func (o Opcodes) CMOVLOC(ops ...Operand) { o.a.op("CMOVLOC", ops...) } func (o Opcodes) Cmovlos(ops ...Operand) { o.a.op("CMOVLOS", ops...) } func (o Opcodes) CMOVLOS(ops ...Operand) { o.a.op("CMOVLOS", ops...) } func (o Opcodes) Cmovlpc(ops ...Operand) { o.a.op("CMOVLPC", ops...) } func (o Opcodes) CMOVLPC(ops ...Operand) { o.a.op("CMOVLPC", ops...) } func (o Opcodes) Cmovlpl(ops ...Operand) { o.a.op("CMOVLPL", ops...) } func (o Opcodes) CMOVLPL(ops ...Operand) { o.a.op("CMOVLPL", ops...) } func (o Opcodes) Cmovlps(ops ...Operand) { o.a.op("CMOVLPS", ops...) } func (o Opcodes) CMOVLPS(ops ...Operand) { o.a.op("CMOVLPS", ops...) } func (o Opcodes) Cmovqcc(ops ...Operand) { o.a.op("CMOVQCC", ops...) } func (o Opcodes) CMOVQCC(ops ...Operand) { o.a.op("CMOVQCC", ops...) } func (o Opcodes) Cmovqcs(ops ...Operand) { o.a.op("CMOVQCS", ops...) } func (o Opcodes) CMOVQCS(ops ...Operand) { o.a.op("CMOVQCS", ops...) } func (o Opcodes) Cmovqeq(ops ...Operand) { o.a.op("CMOVQEQ", ops...) } func (o Opcodes) CMOVQEQ(ops ...Operand) { o.a.op("CMOVQEQ", ops...) } func (o Opcodes) Cmovqge(ops ...Operand) { o.a.op("CMOVQGE", ops...) } func (o Opcodes) CMOVQGE(ops ...Operand) { o.a.op("CMOVQGE", ops...) } func (o Opcodes) Cmovqgt(ops ...Operand) { o.a.op("CMOVQGT", ops...) } func (o Opcodes) CMOVQGT(ops ...Operand) { o.a.op("CMOVQGT", ops...) } func (o Opcodes) Cmovqhi(ops ...Operand) { o.a.op("CMOVQHI", ops...) } func (o Opcodes) CMOVQHI(ops ...Operand) { o.a.op("CMOVQHI", ops...) } func (o Opcodes) Cmovqle(ops ...Operand) { o.a.op("CMOVQLE", ops...) } func (o Opcodes) CMOVQLE(ops ...Operand) { o.a.op("CMOVQLE", ops...) } func (o Opcodes) Cmovqls(ops ...Operand) { o.a.op("CMOVQLS", ops...) } func (o Opcodes) CMOVQLS(ops ...Operand) { o.a.op("CMOVQLS", ops...) } func (o Opcodes) Cmovqlt(ops ...Operand) { o.a.op("CMOVQLT", ops...) } func (o Opcodes) CMOVQLT(ops ...Operand) { o.a.op("CMOVQLT", ops...) } func (o Opcodes) Cmovqmi(ops ...Operand) { o.a.op("CMOVQMI", ops...) } func (o Opcodes) CMOVQMI(ops ...Operand) { o.a.op("CMOVQMI", ops...) } func (o Opcodes) Cmovqne(ops ...Operand) { o.a.op("CMOVQNE", ops...) } func (o Opcodes) CMOVQNE(ops ...Operand) { o.a.op("CMOVQNE", ops...) } func (o Opcodes) Cmovqoc(ops ...Operand) { o.a.op("CMOVQOC", ops...) } func (o Opcodes) CMOVQOC(ops ...Operand) { o.a.op("CMOVQOC", ops...) } func (o Opcodes) Cmovqos(ops ...Operand) { o.a.op("CMOVQOS", ops...) } func (o Opcodes) CMOVQOS(ops ...Operand) { o.a.op("CMOVQOS", ops...) } func (o Opcodes) Cmovqpc(ops ...Operand) { o.a.op("CMOVQPC", ops...) } func (o Opcodes) CMOVQPC(ops ...Operand) { o.a.op("CMOVQPC", ops...) } func (o Opcodes) Cmovqpl(ops ...Operand) { o.a.op("CMOVQPL", ops...) } func (o Opcodes) CMOVQPL(ops ...Operand) { o.a.op("CMOVQPL", ops...) } func (o Opcodes) Cmovqps(ops ...Operand) { o.a.op("CMOVQPS", ops...) } func (o Opcodes) CMOVQPS(ops ...Operand) { o.a.op("CMOVQPS", ops...) } func (o Opcodes) Cmovwcc(ops ...Operand) { o.a.op("CMOVWCC", ops...) } func (o Opcodes) CMOVWCC(ops ...Operand) { o.a.op("CMOVWCC", ops...) } func (o Opcodes) Cmovwcs(ops ...Operand) { o.a.op("CMOVWCS", ops...) } func (o Opcodes) CMOVWCS(ops ...Operand) { o.a.op("CMOVWCS", ops...) } func (o Opcodes) Cmovweq(ops ...Operand) { o.a.op("CMOVWEQ", ops...) } func (o Opcodes) CMOVWEQ(ops ...Operand) { o.a.op("CMOVWEQ", ops...) } func (o Opcodes) Cmovwge(ops ...Operand) { o.a.op("CMOVWGE", ops...) } func (o Opcodes) CMOVWGE(ops ...Operand) { o.a.op("CMOVWGE", ops...) } func (o Opcodes) Cmovwgt(ops ...Operand) { o.a.op("CMOVWGT", ops...) } func (o Opcodes) CMOVWGT(ops ...Operand) { o.a.op("CMOVWGT", ops...) } func (o Opcodes) Cmovwhi(ops ...Operand) { o.a.op("CMOVWHI", ops...) } func (o Opcodes) CMOVWHI(ops ...Operand) { o.a.op("CMOVWHI", ops...) } func (o Opcodes) Cmovwle(ops ...Operand) { o.a.op("CMOVWLE", ops...) } func (o Opcodes) CMOVWLE(ops ...Operand) { o.a.op("CMOVWLE", ops...) } func (o Opcodes) Cmovwls(ops ...Operand) { o.a.op("CMOVWLS", ops...) } func (o Opcodes) CMOVWLS(ops ...Operand) { o.a.op("CMOVWLS", ops...) } func (o Opcodes) Cmovwlt(ops ...Operand) { o.a.op("CMOVWLT", ops...) } func (o Opcodes) CMOVWLT(ops ...Operand) { o.a.op("CMOVWLT", ops...) } func (o Opcodes) Cmovwmi(ops ...Operand) { o.a.op("CMOVWMI", ops...) } func (o Opcodes) CMOVWMI(ops ...Operand) { o.a.op("CMOVWMI", ops...) } func (o Opcodes) Cmovwne(ops ...Operand) { o.a.op("CMOVWNE", ops...) } func (o Opcodes) CMOVWNE(ops ...Operand) { o.a.op("CMOVWNE", ops...) } func (o Opcodes) Cmovwoc(ops ...Operand) { o.a.op("CMOVWOC", ops...) } func (o Opcodes) CMOVWOC(ops ...Operand) { o.a.op("CMOVWOC", ops...) } func (o Opcodes) Cmovwos(ops ...Operand) { o.a.op("CMOVWOS", ops...) } func (o Opcodes) CMOVWOS(ops ...Operand) { o.a.op("CMOVWOS", ops...) } func (o Opcodes) Cmovwpc(ops ...Operand) { o.a.op("CMOVWPC", ops...) } func (o Opcodes) CMOVWPC(ops ...Operand) { o.a.op("CMOVWPC", ops...) } func (o Opcodes) Cmovwpl(ops ...Operand) { o.a.op("CMOVWPL", ops...) } func (o Opcodes) CMOVWPL(ops ...Operand) { o.a.op("CMOVWPL", ops...) } func (o Opcodes) Cmovwps(ops ...Operand) { o.a.op("CMOVWPS", ops...) } func (o Opcodes) CMOVWPS(ops ...Operand) { o.a.op("CMOVWPS", ops...) } func (o Opcodes) Cmpb(ops ...Operand) { o.a.op("CMPB", ops...) } func (o Opcodes) CMPB(ops ...Operand) { o.a.op("CMPB", ops...) } func (o Opcodes) Cmpl(ops ...Operand) { o.a.op("CMPL", ops...) } func (o Opcodes) CMPL(ops ...Operand) { o.a.op("CMPL", ops...) } func (o Opcodes) Cmppd(ops ...Operand) { o.a.op("CMPPD", ops...) } func (o Opcodes) CMPPD(ops ...Operand) { o.a.op("CMPPD", ops...) } func (o Opcodes) Cmpps(ops ...Operand) { o.a.op("CMPPS", ops...) } func (o Opcodes) CMPPS(ops ...Operand) { o.a.op("CMPPS", ops...) } func (o Opcodes) Cmpq(ops ...Operand) { o.a.op("CMPQ", ops...) } func (o Opcodes) CMPQ(ops ...Operand) { o.a.op("CMPQ", ops...) } func (o Opcodes) Cmpsb(ops ...Operand) { o.a.op("CMPSB", ops...) } func (o Opcodes) CMPSB(ops ...Operand) { o.a.op("CMPSB", ops...) } func (o Opcodes) Cmpsd(ops ...Operand) { o.a.op("CMPSD", ops...) } func (o Opcodes) CMPSD(ops ...Operand) { o.a.op("CMPSD", ops...) } func (o Opcodes) Cmpsl(ops ...Operand) { o.a.op("CMPSL", ops...) } func (o Opcodes) CMPSL(ops ...Operand) { o.a.op("CMPSL", ops...) } func (o Opcodes) Cmpsq(ops ...Operand) { o.a.op("CMPSQ", ops...) } func (o Opcodes) CMPSQ(ops ...Operand) { o.a.op("CMPSQ", ops...) } func (o Opcodes) Cmpss(ops ...Operand) { o.a.op("CMPSS", ops...) } func (o Opcodes) CMPSS(ops ...Operand) { o.a.op("CMPSS", ops...) } func (o Opcodes) Cmpsw(ops ...Operand) { o.a.op("CMPSW", ops...) } func (o Opcodes) CMPSW(ops ...Operand) { o.a.op("CMPSW", ops...) } func (o Opcodes) Cmpw(ops ...Operand) { o.a.op("CMPW", ops...) } func (o Opcodes) CMPW(ops ...Operand) { o.a.op("CMPW", ops...) } func (o Opcodes) Cmpxchg16b(ops ...Operand) { o.a.op("CMPXCHG16B", ops...) } func (o Opcodes) CMPXCHG16B(ops ...Operand) { o.a.op("CMPXCHG16B", ops...) } func (o Opcodes) Cmpxchg8b(ops ...Operand) { o.a.op("CMPXCHG8B", ops...) } func (o Opcodes) CMPXCHG8B(ops ...Operand) { o.a.op("CMPXCHG8B", ops...) } func (o Opcodes) Cmpxchgb(ops ...Operand) { o.a.op("CMPXCHGB", ops...) } func (o Opcodes) CMPXCHGB(ops ...Operand) { o.a.op("CMPXCHGB", ops...) } func (o Opcodes) Cmpxchgl(ops ...Operand) { o.a.op("CMPXCHGL", ops...) } func (o Opcodes) CMPXCHGL(ops ...Operand) { o.a.op("CMPXCHGL", ops...) } func (o Opcodes) Cmpxchgq(ops ...Operand) { o.a.op("CMPXCHGQ", ops...) } func (o Opcodes) CMPXCHGQ(ops ...Operand) { o.a.op("CMPXCHGQ", ops...) } func (o Opcodes) Cmpxchgw(ops ...Operand) { o.a.op("CMPXCHGW", ops...) } func (o Opcodes) CMPXCHGW(ops ...Operand) { o.a.op("CMPXCHGW", ops...) } func (o Opcodes) Comisd(ops ...Operand) { o.a.op("COMISD", ops...) } func (o Opcodes) COMISD(ops ...Operand) { o.a.op("COMISD", ops...) } func (o Opcodes) Comiss(ops ...Operand) { o.a.op("COMISS", ops...) } func (o Opcodes) COMISS(ops ...Operand) { o.a.op("COMISS", ops...) } func (o Opcodes) Cpuid(ops ...Operand) { o.a.op("CPUID", ops...) } func (o Opcodes) CPUID(ops ...Operand) { o.a.op("CPUID", ops...) } func (o Opcodes) Cqo(ops ...Operand) { o.a.op("CQO", ops...) } func (o Opcodes) CQO(ops ...Operand) { o.a.op("CQO", ops...) } func (o Opcodes) Crc32b(ops ...Operand) { o.a.op("CRC32B", ops...) } func (o Opcodes) CRC32B(ops ...Operand) { o.a.op("CRC32B", ops...) } func (o Opcodes) Crc32l(ops ...Operand) { o.a.op("CRC32L", ops...) } func (o Opcodes) CRC32L(ops ...Operand) { o.a.op("CRC32L", ops...) } func (o Opcodes) Crc32q(ops ...Operand) { o.a.op("CRC32Q", ops...) } func (o Opcodes) CRC32Q(ops ...Operand) { o.a.op("CRC32Q", ops...) } func (o Opcodes) Crc32w(ops ...Operand) { o.a.op("CRC32W", ops...) } func (o Opcodes) CRC32W(ops ...Operand) { o.a.op("CRC32W", ops...) } func (o Opcodes) Cvtpd2pl(ops ...Operand) { o.a.op("CVTPD2PL", ops...) } func (o Opcodes) CVTPD2PL(ops ...Operand) { o.a.op("CVTPD2PL", ops...) } func (o Opcodes) Cvtpd2ps(ops ...Operand) { o.a.op("CVTPD2PS", ops...) } func (o Opcodes) CVTPD2PS(ops ...Operand) { o.a.op("CVTPD2PS", ops...) } func (o Opcodes) Cvtpl2pd(ops ...Operand) { o.a.op("CVTPL2PD", ops...) } func (o Opcodes) CVTPL2PD(ops ...Operand) { o.a.op("CVTPL2PD", ops...) } func (o Opcodes) Cvtpl2ps(ops ...Operand) { o.a.op("CVTPL2PS", ops...) } func (o Opcodes) CVTPL2PS(ops ...Operand) { o.a.op("CVTPL2PS", ops...) } func (o Opcodes) Cvtps2pd(ops ...Operand) { o.a.op("CVTPS2PD", ops...) } func (o Opcodes) CVTPS2PD(ops ...Operand) { o.a.op("CVTPS2PD", ops...) } func (o Opcodes) Cvtps2pl(ops ...Operand) { o.a.op("CVTPS2PL", ops...) } func (o Opcodes) CVTPS2PL(ops ...Operand) { o.a.op("CVTPS2PL", ops...) } func (o Opcodes) Cvtsd2sl(ops ...Operand) { o.a.op("CVTSD2SL", ops...) } func (o Opcodes) CVTSD2SL(ops ...Operand) { o.a.op("CVTSD2SL", ops...) } func (o Opcodes) Cvtsd2sq(ops ...Operand) { o.a.op("CVTSD2SQ", ops...) } func (o Opcodes) CVTSD2SQ(ops ...Operand) { o.a.op("CVTSD2SQ", ops...) } func (o Opcodes) Cvtsd2ss(ops ...Operand) { o.a.op("CVTSD2SS", ops...) } func (o Opcodes) CVTSD2SS(ops ...Operand) { o.a.op("CVTSD2SS", ops...) } func (o Opcodes) Cvtsl2sd(ops ...Operand) { o.a.op("CVTSL2SD", ops...) } func (o Opcodes) CVTSL2SD(ops ...Operand) { o.a.op("CVTSL2SD", ops...) } func (o Opcodes) Cvtsl2ss(ops ...Operand) { o.a.op("CVTSL2SS", ops...) } func (o Opcodes) CVTSL2SS(ops ...Operand) { o.a.op("CVTSL2SS", ops...) } func (o Opcodes) Cvtsq2sd(ops ...Operand) { o.a.op("CVTSQ2SD", ops...) } func (o Opcodes) CVTSQ2SD(ops ...Operand) { o.a.op("CVTSQ2SD", ops...) } func (o Opcodes) Cvtsq2ss(ops ...Operand) { o.a.op("CVTSQ2SS", ops...) } func (o Opcodes) CVTSQ2SS(ops ...Operand) { o.a.op("CVTSQ2SS", ops...) } func (o Opcodes) Cvtss2sd(ops ...Operand) { o.a.op("CVTSS2SD", ops...) } func (o Opcodes) CVTSS2SD(ops ...Operand) { o.a.op("CVTSS2SD", ops...) } func (o Opcodes) Cvtss2sl(ops ...Operand) { o.a.op("CVTSS2SL", ops...) } func (o Opcodes) CVTSS2SL(ops ...Operand) { o.a.op("CVTSS2SL", ops...) } func (o Opcodes) Cvtss2sq(ops ...Operand) { o.a.op("CVTSS2SQ", ops...) } func (o Opcodes) CVTSS2SQ(ops ...Operand) { o.a.op("CVTSS2SQ", ops...) } func (o Opcodes) Cvttpd2pl(ops ...Operand) { o.a.op("CVTTPD2PL", ops...) } func (o Opcodes) CVTTPD2PL(ops ...Operand) { o.a.op("CVTTPD2PL", ops...) } func (o Opcodes) Cvttps2pl(ops ...Operand) { o.a.op("CVTTPS2PL", ops...) } func (o Opcodes) CVTTPS2PL(ops ...Operand) { o.a.op("CVTTPS2PL", ops...) } func (o Opcodes) Cvttsd2sl(ops ...Operand) { o.a.op("CVTTSD2SL", ops...) } func (o Opcodes) CVTTSD2SL(ops ...Operand) { o.a.op("CVTTSD2SL", ops...) } func (o Opcodes) Cvttsd2sq(ops ...Operand) { o.a.op("CVTTSD2SQ", ops...) } func (o Opcodes) CVTTSD2SQ(ops ...Operand) { o.a.op("CVTTSD2SQ", ops...) } func (o Opcodes) Cvttss2sl(ops ...Operand) { o.a.op("CVTTSS2SL", ops...) } func (o Opcodes) CVTTSS2SL(ops ...Operand) { o.a.op("CVTTSS2SL", ops...) } func (o Opcodes) Cvttss2sq(ops ...Operand) { o.a.op("CVTTSS2SQ", ops...) } func (o Opcodes) CVTTSS2SQ(ops ...Operand) { o.a.op("CVTTSS2SQ", ops...) } func (o Opcodes) Cwd(ops ...Operand) { o.a.op("CWD", ops...) } func (o Opcodes) CWD(ops ...Operand) { o.a.op("CWD", ops...) } func (o Opcodes) Cwde(ops ...Operand) { o.a.op("CWDE", ops...) } func (o Opcodes) CWDE(ops ...Operand) { o.a.op("CWDE", ops...) } func (o Opcodes) Daa(ops ...Operand) { o.a.op("DAA", ops...) } func (o Opcodes) DAA(ops ...Operand) { o.a.op("DAA", ops...) } func (o Opcodes) Das(ops ...Operand) { o.a.op("DAS", ops...) } func (o Opcodes) DAS(ops ...Operand) { o.a.op("DAS", ops...) } func (o Opcodes) Decb(ops ...Operand) { o.a.op("DECB", ops...) } func (o Opcodes) DECB(ops ...Operand) { o.a.op("DECB", ops...) } func (o Opcodes) Decl(ops ...Operand) { o.a.op("DECL", ops...) } func (o Opcodes) DECL(ops ...Operand) { o.a.op("DECL", ops...) } func (o Opcodes) Decq(ops ...Operand) { o.a.op("DECQ", ops...) } func (o Opcodes) DECQ(ops ...Operand) { o.a.op("DECQ", ops...) } func (o Opcodes) Decw(ops ...Operand) { o.a.op("DECW", ops...) } func (o Opcodes) DECW(ops ...Operand) { o.a.op("DECW", ops...) } func (o Opcodes) Divb(ops ...Operand) { o.a.op("DIVB", ops...) } func (o Opcodes) DIVB(ops ...Operand) { o.a.op("DIVB", ops...) } func (o Opcodes) Divl(ops ...Operand) { o.a.op("DIVL", ops...) } func (o Opcodes) DIVL(ops ...Operand) { o.a.op("DIVL", ops...) } func (o Opcodes) Divpd(ops ...Operand) { o.a.op("DIVPD", ops...) } func (o Opcodes) DIVPD(ops ...Operand) { o.a.op("DIVPD", ops...) } func (o Opcodes) Divps(ops ...Operand) { o.a.op("DIVPS", ops...) } func (o Opcodes) DIVPS(ops ...Operand) { o.a.op("DIVPS", ops...) } func (o Opcodes) Divq(ops ...Operand) { o.a.op("DIVQ", ops...) } func (o Opcodes) DIVQ(ops ...Operand) { o.a.op("DIVQ", ops...) } func (o Opcodes) Divsd(ops ...Operand) { o.a.op("DIVSD", ops...) } func (o Opcodes) DIVSD(ops ...Operand) { o.a.op("DIVSD", ops...) } func (o Opcodes) Divss(ops ...Operand) { o.a.op("DIVSS", ops...) } func (o Opcodes) DIVSS(ops ...Operand) { o.a.op("DIVSS", ops...) } func (o Opcodes) Divw(ops ...Operand) { o.a.op("DIVW", ops...) } func (o Opcodes) DIVW(ops ...Operand) { o.a.op("DIVW", ops...) } func (o Opcodes) Dppd(ops ...Operand) { o.a.op("DPPD", ops...) } func (o Opcodes) DPPD(ops ...Operand) { o.a.op("DPPD", ops...) } func (o Opcodes) Dpps(ops ...Operand) { o.a.op("DPPS", ops...) } func (o Opcodes) DPPS(ops ...Operand) { o.a.op("DPPS", ops...) } func (o Opcodes) Emms(ops ...Operand) { o.a.op("EMMS", ops...) } func (o Opcodes) EMMS(ops ...Operand) { o.a.op("EMMS", ops...) } func (o Opcodes) Enter(ops ...Operand) { o.a.op("ENTER", ops...) } func (o Opcodes) ENTER(ops ...Operand) { o.a.op("ENTER", ops...) } func (o Opcodes) Extractps(ops ...Operand) { o.a.op("EXTRACTPS", ops...) } func (o Opcodes) EXTRACTPS(ops ...Operand) { o.a.op("EXTRACTPS", ops...) } func (o Opcodes) F2xm1(ops ...Operand) { o.a.op("F2XM1", ops...) } func (o Opcodes) F2XM1(ops ...Operand) { o.a.op("F2XM1", ops...) } func (o Opcodes) Fabs(ops ...Operand) { o.a.op("FABS", ops...) } func (o Opcodes) FABS(ops ...Operand) { o.a.op("FABS", ops...) } func (o Opcodes) Faddd(ops ...Operand) { o.a.op("FADDD", ops...) } func (o Opcodes) FADDD(ops ...Operand) { o.a.op("FADDD", ops...) } func (o Opcodes) Fadddp(ops ...Operand) { o.a.op("FADDDP", ops...) } func (o Opcodes) FADDDP(ops ...Operand) { o.a.op("FADDDP", ops...) } func (o Opcodes) Faddf(ops ...Operand) { o.a.op("FADDF", ops...) } func (o Opcodes) FADDF(ops ...Operand) { o.a.op("FADDF", ops...) } func (o Opcodes) Faddl(ops ...Operand) { o.a.op("FADDL", ops...) } func (o Opcodes) FADDL(ops ...Operand) { o.a.op("FADDL", ops...) } func (o Opcodes) Faddw(ops ...Operand) { o.a.op("FADDW", ops...) } func (o Opcodes) FADDW(ops ...Operand) { o.a.op("FADDW", ops...) } func (o Opcodes) Fbld(ops ...Operand) { o.a.op("FBLD", ops...) } func (o Opcodes) FBLD(ops ...Operand) { o.a.op("FBLD", ops...) } func (o Opcodes) Fbstp(ops ...Operand) { o.a.op("FBSTP", ops...) } func (o Opcodes) FBSTP(ops ...Operand) { o.a.op("FBSTP", ops...) } func (o Opcodes) Fchs(ops ...Operand) { o.a.op("FCHS", ops...) } func (o Opcodes) FCHS(ops ...Operand) { o.a.op("FCHS", ops...) } func (o Opcodes) Fclex(ops ...Operand) { o.a.op("FCLEX", ops...) } func (o Opcodes) FCLEX(ops ...Operand) { o.a.op("FCLEX", ops...) } func (o Opcodes) Fcmovb(ops ...Operand) { o.a.op("FCMOVB", ops...) } func (o Opcodes) FCMOVB(ops ...Operand) { o.a.op("FCMOVB", ops...) } func (o Opcodes) Fcmovbe(ops ...Operand) { o.a.op("FCMOVBE", ops...) } func (o Opcodes) FCMOVBE(ops ...Operand) { o.a.op("FCMOVBE", ops...) } func (o Opcodes) Fcmovcc(ops ...Operand) { o.a.op("FCMOVCC", ops...) } func (o Opcodes) FCMOVCC(ops ...Operand) { o.a.op("FCMOVCC", ops...) } func (o Opcodes) Fcmovcs(ops ...Operand) { o.a.op("FCMOVCS", ops...) } func (o Opcodes) FCMOVCS(ops ...Operand) { o.a.op("FCMOVCS", ops...) } func (o Opcodes) Fcmove(ops ...Operand) { o.a.op("FCMOVE", ops...) } func (o Opcodes) FCMOVE(ops ...Operand) { o.a.op("FCMOVE", ops...) } func (o Opcodes) Fcmoveq(ops ...Operand) { o.a.op("FCMOVEQ", ops...) } func (o Opcodes) FCMOVEQ(ops ...Operand) { o.a.op("FCMOVEQ", ops...) } func (o Opcodes) Fcmovhi(ops ...Operand) { o.a.op("FCMOVHI", ops...) } func (o Opcodes) FCMOVHI(ops ...Operand) { o.a.op("FCMOVHI", ops...) } func (o Opcodes) Fcmovls(ops ...Operand) { o.a.op("FCMOVLS", ops...) } func (o Opcodes) FCMOVLS(ops ...Operand) { o.a.op("FCMOVLS", ops...) } func (o Opcodes) Fcmovnb(ops ...Operand) { o.a.op("FCMOVNB", ops...) } func (o Opcodes) FCMOVNB(ops ...Operand) { o.a.op("FCMOVNB", ops...) } func (o Opcodes) Fcmovnbe(ops ...Operand) { o.a.op("FCMOVNBE", ops...) } func (o Opcodes) FCMOVNBE(ops ...Operand) { o.a.op("FCMOVNBE", ops...) } func (o Opcodes) Fcmovne(ops ...Operand) { o.a.op("FCMOVNE", ops...) } func (o Opcodes) FCMOVNE(ops ...Operand) { o.a.op("FCMOVNE", ops...) } func (o Opcodes) Fcmovnu(ops ...Operand) { o.a.op("FCMOVNU", ops...) } func (o Opcodes) FCMOVNU(ops ...Operand) { o.a.op("FCMOVNU", ops...) } func (o Opcodes) Fcmovu(ops ...Operand) { o.a.op("FCMOVU", ops...) } func (o Opcodes) FCMOVU(ops ...Operand) { o.a.op("FCMOVU", ops...) } func (o Opcodes) Fcmovun(ops ...Operand) { o.a.op("FCMOVUN", ops...) } func (o Opcodes) FCMOVUN(ops ...Operand) { o.a.op("FCMOVUN", ops...) } func (o Opcodes) Fcomd(ops ...Operand) { o.a.op("FCOMD", ops...) } func (o Opcodes) FCOMD(ops ...Operand) { o.a.op("FCOMD", ops...) } func (o Opcodes) Fcomdp(ops ...Operand) { o.a.op("FCOMDP", ops...) } func (o Opcodes) FCOMDP(ops ...Operand) { o.a.op("FCOMDP", ops...) } func (o Opcodes) Fcomdpp(ops ...Operand) { o.a.op("FCOMDPP", ops...) } func (o Opcodes) FCOMDPP(ops ...Operand) { o.a.op("FCOMDPP", ops...) } func (o Opcodes) Fcomf(ops ...Operand) { o.a.op("FCOMF", ops...) } func (o Opcodes) FCOMF(ops ...Operand) { o.a.op("FCOMF", ops...) } func (o Opcodes) Fcomfp(ops ...Operand) { o.a.op("FCOMFP", ops...) } func (o Opcodes) FCOMFP(ops ...Operand) { o.a.op("FCOMFP", ops...) } func (o Opcodes) Fcomi(ops ...Operand) { o.a.op("FCOMI", ops...) } func (o Opcodes) FCOMI(ops ...Operand) { o.a.op("FCOMI", ops...) } func (o Opcodes) Fcomip(ops ...Operand) { o.a.op("FCOMIP", ops...) } func (o Opcodes) FCOMIP(ops ...Operand) { o.a.op("FCOMIP", ops...) } func (o Opcodes) Fcoml(ops ...Operand) { o.a.op("FCOML", ops...) } func (o Opcodes) FCOML(ops ...Operand) { o.a.op("FCOML", ops...) } func (o Opcodes) Fcomlp(ops ...Operand) { o.a.op("FCOMLP", ops...) } func (o Opcodes) FCOMLP(ops ...Operand) { o.a.op("FCOMLP", ops...) } func (o Opcodes) Fcomw(ops ...Operand) { o.a.op("FCOMW", ops...) } func (o Opcodes) FCOMW(ops ...Operand) { o.a.op("FCOMW", ops...) } func (o Opcodes) Fcomwp(ops ...Operand) { o.a.op("FCOMWP", ops...) } func (o Opcodes) FCOMWP(ops ...Operand) { o.a.op("FCOMWP", ops...) } func (o Opcodes) Fcos(ops ...Operand) { o.a.op("FCOS", ops...) } func (o Opcodes) FCOS(ops ...Operand) { o.a.op("FCOS", ops...) } func (o Opcodes) Fdecstp(ops ...Operand) { o.a.op("FDECSTP", ops...) } func (o Opcodes) FDECSTP(ops ...Operand) { o.a.op("FDECSTP", ops...) } func (o Opcodes) Fdivd(ops ...Operand) { o.a.op("FDIVD", ops...) } func (o Opcodes) FDIVD(ops ...Operand) { o.a.op("FDIVD", ops...) } func (o Opcodes) Fdivdp(ops ...Operand) { o.a.op("FDIVDP", ops...) } func (o Opcodes) FDIVDP(ops ...Operand) { o.a.op("FDIVDP", ops...) } func (o Opcodes) Fdivf(ops ...Operand) { o.a.op("FDIVF", ops...) } func (o Opcodes) FDIVF(ops ...Operand) { o.a.op("FDIVF", ops...) } func (o Opcodes) Fdivl(ops ...Operand) { o.a.op("FDIVL", ops...) } func (o Opcodes) FDIVL(ops ...Operand) { o.a.op("FDIVL", ops...) } func (o Opcodes) Fdivrd(ops ...Operand) { o.a.op("FDIVRD", ops...) } func (o Opcodes) FDIVRD(ops ...Operand) { o.a.op("FDIVRD", ops...) } func (o Opcodes) Fdivrdp(ops ...Operand) { o.a.op("FDIVRDP", ops...) } func (o Opcodes) FDIVRDP(ops ...Operand) { o.a.op("FDIVRDP", ops...) } func (o Opcodes) Fdivrf(ops ...Operand) { o.a.op("FDIVRF", ops...) } func (o Opcodes) FDIVRF(ops ...Operand) { o.a.op("FDIVRF", ops...) } func (o Opcodes) Fdivrl(ops ...Operand) { o.a.op("FDIVRL", ops...) } func (o Opcodes) FDIVRL(ops ...Operand) { o.a.op("FDIVRL", ops...) } func (o Opcodes) Fdivrw(ops ...Operand) { o.a.op("FDIVRW", ops...) } func (o Opcodes) FDIVRW(ops ...Operand) { o.a.op("FDIVRW", ops...) } func (o Opcodes) Fdivw(ops ...Operand) { o.a.op("FDIVW", ops...) } func (o Opcodes) FDIVW(ops ...Operand) { o.a.op("FDIVW", ops...) } func (o Opcodes) Ffree(ops ...Operand) { o.a.op("FFREE", ops...) } func (o Opcodes) FFREE(ops ...Operand) { o.a.op("FFREE", ops...) } func (o Opcodes) Fincstp(ops ...Operand) { o.a.op("FINCSTP", ops...) } func (o Opcodes) FINCSTP(ops ...Operand) { o.a.op("FINCSTP", ops...) } func (o Opcodes) Finit(ops ...Operand) { o.a.op("FINIT", ops...) } func (o Opcodes) FINIT(ops ...Operand) { o.a.op("FINIT", ops...) } func (o Opcodes) Fld1(ops ...Operand) { o.a.op("FLD1", ops...) } func (o Opcodes) FLD1(ops ...Operand) { o.a.op("FLD1", ops...) } func (o Opcodes) Fldcw(ops ...Operand) { o.a.op("FLDCW", ops...) } func (o Opcodes) FLDCW(ops ...Operand) { o.a.op("FLDCW", ops...) } func (o Opcodes) Fldenv(ops ...Operand) { o.a.op("FLDENV", ops...) } func (o Opcodes) FLDENV(ops ...Operand) { o.a.op("FLDENV", ops...) } func (o Opcodes) Fldl2e(ops ...Operand) { o.a.op("FLDL2E", ops...) } func (o Opcodes) FLDL2E(ops ...Operand) { o.a.op("FLDL2E", ops...) } func (o Opcodes) Fldl2t(ops ...Operand) { o.a.op("FLDL2T", ops...) } func (o Opcodes) FLDL2T(ops ...Operand) { o.a.op("FLDL2T", ops...) } func (o Opcodes) Fldlg2(ops ...Operand) { o.a.op("FLDLG2", ops...) } func (o Opcodes) FLDLG2(ops ...Operand) { o.a.op("FLDLG2", ops...) } func (o Opcodes) Fldln2(ops ...Operand) { o.a.op("FLDLN2", ops...) } func (o Opcodes) FLDLN2(ops ...Operand) { o.a.op("FLDLN2", ops...) } func (o Opcodes) Fldpi(ops ...Operand) { o.a.op("FLDPI", ops...) } func (o Opcodes) FLDPI(ops ...Operand) { o.a.op("FLDPI", ops...) } func (o Opcodes) Fldz(ops ...Operand) { o.a.op("FLDZ", ops...) } func (o Opcodes) FLDZ(ops ...Operand) { o.a.op("FLDZ", ops...) } func (o Opcodes) Fmovb(ops ...Operand) { o.a.op("FMOVB", ops...) } func (o Opcodes) FMOVB(ops ...Operand) { o.a.op("FMOVB", ops...) } func (o Opcodes) Fmovbp(ops ...Operand) { o.a.op("FMOVBP", ops...) } func (o Opcodes) FMOVBP(ops ...Operand) { o.a.op("FMOVBP", ops...) } func (o Opcodes) Fmovd(ops ...Operand) { o.a.op("FMOVD", ops...) } func (o Opcodes) FMOVD(ops ...Operand) { o.a.op("FMOVD", ops...) } func (o Opcodes) Fmovdp(ops ...Operand) { o.a.op("FMOVDP", ops...) } func (o Opcodes) FMOVDP(ops ...Operand) { o.a.op("FMOVDP", ops...) } func (o Opcodes) Fmovf(ops ...Operand) { o.a.op("FMOVF", ops...) } func (o Opcodes) FMOVF(ops ...Operand) { o.a.op("FMOVF", ops...) } func (o Opcodes) Fmovfp(ops ...Operand) { o.a.op("FMOVFP", ops...) } func (o Opcodes) FMOVFP(ops ...Operand) { o.a.op("FMOVFP", ops...) } func (o Opcodes) Fmovl(ops ...Operand) { o.a.op("FMOVL", ops...) } func (o Opcodes) FMOVL(ops ...Operand) { o.a.op("FMOVL", ops...) } func (o Opcodes) Fmovlp(ops ...Operand) { o.a.op("FMOVLP", ops...) } func (o Opcodes) FMOVLP(ops ...Operand) { o.a.op("FMOVLP", ops...) } func (o Opcodes) Fmovv(ops ...Operand) { o.a.op("FMOVV", ops...) } func (o Opcodes) FMOVV(ops ...Operand) { o.a.op("FMOVV", ops...) } func (o Opcodes) Fmovvp(ops ...Operand) { o.a.op("FMOVVP", ops...) } func (o Opcodes) FMOVVP(ops ...Operand) { o.a.op("FMOVVP", ops...) } func (o Opcodes) Fmovw(ops ...Operand) { o.a.op("FMOVW", ops...) } func (o Opcodes) FMOVW(ops ...Operand) { o.a.op("FMOVW", ops...) } func (o Opcodes) Fmovwp(ops ...Operand) { o.a.op("FMOVWP", ops...) } func (o Opcodes) FMOVWP(ops ...Operand) { o.a.op("FMOVWP", ops...) } func (o Opcodes) Fmovx(ops ...Operand) { o.a.op("FMOVX", ops...) } func (o Opcodes) FMOVX(ops ...Operand) { o.a.op("FMOVX", ops...) } func (o Opcodes) Fmovxp(ops ...Operand) { o.a.op("FMOVXP", ops...) } func (o Opcodes) FMOVXP(ops ...Operand) { o.a.op("FMOVXP", ops...) } func (o Opcodes) Fmuld(ops ...Operand) { o.a.op("FMULD", ops...) } func (o Opcodes) FMULD(ops ...Operand) { o.a.op("FMULD", ops...) } func (o Opcodes) Fmuldp(ops ...Operand) { o.a.op("FMULDP", ops...) } func (o Opcodes) FMULDP(ops ...Operand) { o.a.op("FMULDP", ops...) } func (o Opcodes) Fmulf(ops ...Operand) { o.a.op("FMULF", ops...) } func (o Opcodes) FMULF(ops ...Operand) { o.a.op("FMULF", ops...) } func (o Opcodes) Fmull(ops ...Operand) { o.a.op("FMULL", ops...) } func (o Opcodes) FMULL(ops ...Operand) { o.a.op("FMULL", ops...) } func (o Opcodes) Fmulw(ops ...Operand) { o.a.op("FMULW", ops...) } func (o Opcodes) FMULW(ops ...Operand) { o.a.op("FMULW", ops...) } func (o Opcodes) Fnop(ops ...Operand) { o.a.op("FNOP", ops...) } func (o Opcodes) FNOP(ops ...Operand) { o.a.op("FNOP", ops...) } func (o Opcodes) Fpatan(ops ...Operand) { o.a.op("FPATAN", ops...) } func (o Opcodes) FPATAN(ops ...Operand) { o.a.op("FPATAN", ops...) } func (o Opcodes) Fprem(ops ...Operand) { o.a.op("FPREM", ops...) } func (o Opcodes) FPREM(ops ...Operand) { o.a.op("FPREM", ops...) } func (o Opcodes) Fprem1(ops ...Operand) { o.a.op("FPREM1", ops...) } func (o Opcodes) FPREM1(ops ...Operand) { o.a.op("FPREM1", ops...) } func (o Opcodes) Fptan(ops ...Operand) { o.a.op("FPTAN", ops...) } func (o Opcodes) FPTAN(ops ...Operand) { o.a.op("FPTAN", ops...) } func (o Opcodes) Frndint(ops ...Operand) { o.a.op("FRNDINT", ops...) } func (o Opcodes) FRNDINT(ops ...Operand) { o.a.op("FRNDINT", ops...) } func (o Opcodes) Frstor(ops ...Operand) { o.a.op("FRSTOR", ops...) } func (o Opcodes) FRSTOR(ops ...Operand) { o.a.op("FRSTOR", ops...) } func (o Opcodes) Fsave(ops ...Operand) { o.a.op("FSAVE", ops...) } func (o Opcodes) FSAVE(ops ...Operand) { o.a.op("FSAVE", ops...) } func (o Opcodes) Fscale(ops ...Operand) { o.a.op("FSCALE", ops...) } func (o Opcodes) FSCALE(ops ...Operand) { o.a.op("FSCALE", ops...) } func (o Opcodes) Fsin(ops ...Operand) { o.a.op("FSIN", ops...) } func (o Opcodes) FSIN(ops ...Operand) { o.a.op("FSIN", ops...) } func (o Opcodes) Fsincos(ops ...Operand) { o.a.op("FSINCOS", ops...) } func (o Opcodes) FSINCOS(ops ...Operand) { o.a.op("FSINCOS", ops...) } func (o Opcodes) Fsqrt(ops ...Operand) { o.a.op("FSQRT", ops...) } func (o Opcodes) FSQRT(ops ...Operand) { o.a.op("FSQRT", ops...) } func (o Opcodes) Fstcw(ops ...Operand) { o.a.op("FSTCW", ops...) } func (o Opcodes) FSTCW(ops ...Operand) { o.a.op("FSTCW", ops...) } func (o Opcodes) Fstenv(ops ...Operand) { o.a.op("FSTENV", ops...) } func (o Opcodes) FSTENV(ops ...Operand) { o.a.op("FSTENV", ops...) } func (o Opcodes) Fstsw(ops ...Operand) { o.a.op("FSTSW", ops...) } func (o Opcodes) FSTSW(ops ...Operand) { o.a.op("FSTSW", ops...) } func (o Opcodes) Fsubd(ops ...Operand) { o.a.op("FSUBD", ops...) } func (o Opcodes) FSUBD(ops ...Operand) { o.a.op("FSUBD", ops...) } func (o Opcodes) Fsubdp(ops ...Operand) { o.a.op("FSUBDP", ops...) } func (o Opcodes) FSUBDP(ops ...Operand) { o.a.op("FSUBDP", ops...) } func (o Opcodes) Fsubf(ops ...Operand) { o.a.op("FSUBF", ops...) } func (o Opcodes) FSUBF(ops ...Operand) { o.a.op("FSUBF", ops...) } func (o Opcodes) Fsubl(ops ...Operand) { o.a.op("FSUBL", ops...) } func (o Opcodes) FSUBL(ops ...Operand) { o.a.op("FSUBL", ops...) } func (o Opcodes) Fsubrd(ops ...Operand) { o.a.op("FSUBRD", ops...) } func (o Opcodes) FSUBRD(ops ...Operand) { o.a.op("FSUBRD", ops...) } func (o Opcodes) Fsubrdp(ops ...Operand) { o.a.op("FSUBRDP", ops...) } func (o Opcodes) FSUBRDP(ops ...Operand) { o.a.op("FSUBRDP", ops...) } func (o Opcodes) Fsubrf(ops ...Operand) { o.a.op("FSUBRF", ops...) } func (o Opcodes) FSUBRF(ops ...Operand) { o.a.op("FSUBRF", ops...) } func (o Opcodes) Fsubrl(ops ...Operand) { o.a.op("FSUBRL", ops...) } func (o Opcodes) FSUBRL(ops ...Operand) { o.a.op("FSUBRL", ops...) } func (o Opcodes) Fsubrw(ops ...Operand) { o.a.op("FSUBRW", ops...) } func (o Opcodes) FSUBRW(ops ...Operand) { o.a.op("FSUBRW", ops...) } func (o Opcodes) Fsubw(ops ...Operand) { o.a.op("FSUBW", ops...) } func (o Opcodes) FSUBW(ops ...Operand) { o.a.op("FSUBW", ops...) } func (o Opcodes) Ftst(ops ...Operand) { o.a.op("FTST", ops...) } func (o Opcodes) FTST(ops ...Operand) { o.a.op("FTST", ops...) } func (o Opcodes) Fucom(ops ...Operand) { o.a.op("FUCOM", ops...) } func (o Opcodes) FUCOM(ops ...Operand) { o.a.op("FUCOM", ops...) } func (o Opcodes) Fucomi(ops ...Operand) { o.a.op("FUCOMI", ops...) } func (o Opcodes) FUCOMI(ops ...Operand) { o.a.op("FUCOMI", ops...) } func (o Opcodes) Fucomip(ops ...Operand) { o.a.op("FUCOMIP", ops...) } func (o Opcodes) FUCOMIP(ops ...Operand) { o.a.op("FUCOMIP", ops...) } func (o Opcodes) Fucomp(ops ...Operand) { o.a.op("FUCOMP", ops...) } func (o Opcodes) FUCOMP(ops ...Operand) { o.a.op("FUCOMP", ops...) } func (o Opcodes) Fucompp(ops ...Operand) { o.a.op("FUCOMPP", ops...) } func (o Opcodes) FUCOMPP(ops ...Operand) { o.a.op("FUCOMPP", ops...) } func (o Opcodes) Fxam(ops ...Operand) { o.a.op("FXAM", ops...) } func (o Opcodes) FXAM(ops ...Operand) { o.a.op("FXAM", ops...) } func (o Opcodes) Fxchd(ops ...Operand) { o.a.op("FXCHD", ops...) } func (o Opcodes) FXCHD(ops ...Operand) { o.a.op("FXCHD", ops...) } func (o Opcodes) Fxrstor(ops ...Operand) { o.a.op("FXRSTOR", ops...) } func (o Opcodes) FXRSTOR(ops ...Operand) { o.a.op("FXRSTOR", ops...) } func (o Opcodes) Fxrstor64(ops ...Operand) { o.a.op("FXRSTOR64", ops...) } func (o Opcodes) FXRSTOR64(ops ...Operand) { o.a.op("FXRSTOR64", ops...) } func (o Opcodes) Fxsave(ops ...Operand) { o.a.op("FXSAVE", ops...) } func (o Opcodes) FXSAVE(ops ...Operand) { o.a.op("FXSAVE", ops...) } func (o Opcodes) Fxsave64(ops ...Operand) { o.a.op("FXSAVE64", ops...) } func (o Opcodes) FXSAVE64(ops ...Operand) { o.a.op("FXSAVE64", ops...) } func (o Opcodes) Fxtract(ops ...Operand) { o.a.op("FXTRACT", ops...) } func (o Opcodes) FXTRACT(ops ...Operand) { o.a.op("FXTRACT", ops...) } func (o Opcodes) Fyl2x(ops ...Operand) { o.a.op("FYL2X", ops...) } func (o Opcodes) FYL2X(ops ...Operand) { o.a.op("FYL2X", ops...) } func (o Opcodes) Fyl2xp1(ops ...Operand) { o.a.op("FYL2XP1", ops...) } func (o Opcodes) FYL2XP1(ops ...Operand) { o.a.op("FYL2XP1", ops...) } func (o Opcodes) Haddpd(ops ...Operand) { o.a.op("HADDPD", ops...) } func (o Opcodes) HADDPD(ops ...Operand) { o.a.op("HADDPD", ops...) } func (o Opcodes) Haddps(ops ...Operand) { o.a.op("HADDPS", ops...) } func (o Opcodes) HADDPS(ops ...Operand) { o.a.op("HADDPS", ops...) } func (o Opcodes) Hlt(ops ...Operand) { o.a.op("HLT", ops...) } func (o Opcodes) HLT(ops ...Operand) { o.a.op("HLT", ops...) } func (o Opcodes) Hsubpd(ops ...Operand) { o.a.op("HSUBPD", ops...) } func (o Opcodes) HSUBPD(ops ...Operand) { o.a.op("HSUBPD", ops...) } func (o Opcodes) Hsubps(ops ...Operand) { o.a.op("HSUBPS", ops...) } func (o Opcodes) HSUBPS(ops ...Operand) { o.a.op("HSUBPS", ops...) } func (o Opcodes) Icebp(ops ...Operand) { o.a.op("ICEBP", ops...) } func (o Opcodes) ICEBP(ops ...Operand) { o.a.op("ICEBP", ops...) } func (o Opcodes) Idivb(ops ...Operand) { o.a.op("IDIVB", ops...) } func (o Opcodes) IDIVB(ops ...Operand) { o.a.op("IDIVB", ops...) } func (o Opcodes) Idivl(ops ...Operand) { o.a.op("IDIVL", ops...) } func (o Opcodes) IDIVL(ops ...Operand) { o.a.op("IDIVL", ops...) } func (o Opcodes) Idivq(ops ...Operand) { o.a.op("IDIVQ", ops...) } func (o Opcodes) IDIVQ(ops ...Operand) { o.a.op("IDIVQ", ops...) } func (o Opcodes) Idivw(ops ...Operand) { o.a.op("IDIVW", ops...) } func (o Opcodes) IDIVW(ops ...Operand) { o.a.op("IDIVW", ops...) } func (o Opcodes) Imul3l(ops ...Operand) { o.a.op("IMUL3L", ops...) } func (o Opcodes) IMUL3L(ops ...Operand) { o.a.op("IMUL3L", ops...) } func (o Opcodes) Imul3q(ops ...Operand) { o.a.op("IMUL3Q", ops...) } func (o Opcodes) IMUL3Q(ops ...Operand) { o.a.op("IMUL3Q", ops...) } func (o Opcodes) Imul3w(ops ...Operand) { o.a.op("IMUL3W", ops...) } func (o Opcodes) IMUL3W(ops ...Operand) { o.a.op("IMUL3W", ops...) } func (o Opcodes) Imulb(ops ...Operand) { o.a.op("IMULB", ops...) } func (o Opcodes) IMULB(ops ...Operand) { o.a.op("IMULB", ops...) } func (o Opcodes) Imull(ops ...Operand) { o.a.op("IMULL", ops...) } func (o Opcodes) IMULL(ops ...Operand) { o.a.op("IMULL", ops...) } func (o Opcodes) Imulq(ops ...Operand) { o.a.op("IMULQ", ops...) } func (o Opcodes) IMULQ(ops ...Operand) { o.a.op("IMULQ", ops...) } func (o Opcodes) Imulw(ops ...Operand) { o.a.op("IMULW", ops...) } func (o Opcodes) IMULW(ops ...Operand) { o.a.op("IMULW", ops...) } func (o Opcodes) Inb(ops ...Operand) { o.a.op("INB", ops...) } func (o Opcodes) INB(ops ...Operand) { o.a.op("INB", ops...) } func (o Opcodes) Incb(ops ...Operand) { o.a.op("INCB", ops...) } func (o Opcodes) INCB(ops ...Operand) { o.a.op("INCB", ops...) } func (o Opcodes) Incl(ops ...Operand) { o.a.op("INCL", ops...) } func (o Opcodes) INCL(ops ...Operand) { o.a.op("INCL", ops...) } func (o Opcodes) Incq(ops ...Operand) { o.a.op("INCQ", ops...) } func (o Opcodes) INCQ(ops ...Operand) { o.a.op("INCQ", ops...) } func (o Opcodes) Incw(ops ...Operand) { o.a.op("INCW", ops...) } func (o Opcodes) INCW(ops ...Operand) { o.a.op("INCW", ops...) } func (o Opcodes) Inl(ops ...Operand) { o.a.op("INL", ops...) } func (o Opcodes) INL(ops ...Operand) { o.a.op("INL", ops...) } func (o Opcodes) Insb(ops ...Operand) { o.a.op("INSB", ops...) } func (o Opcodes) INSB(ops ...Operand) { o.a.op("INSB", ops...) } func (o Opcodes) Insertps(ops ...Operand) { o.a.op("INSERTPS", ops...) } func (o Opcodes) INSERTPS(ops ...Operand) { o.a.op("INSERTPS", ops...) } func (o Opcodes) Insl(ops ...Operand) { o.a.op("INSL", ops...) } func (o Opcodes) INSL(ops ...Operand) { o.a.op("INSL", ops...) } func (o Opcodes) Insw(ops ...Operand) { o.a.op("INSW", ops...) } func (o Opcodes) INSW(ops ...Operand) { o.a.op("INSW", ops...) } func (o Opcodes) Int(ops ...Operand) { o.a.op("INT", ops...) } func (o Opcodes) INT(ops ...Operand) { o.a.op("INT", ops...) } func (o Opcodes) Into(ops ...Operand) { o.a.op("INTO", ops...) } func (o Opcodes) INTO(ops ...Operand) { o.a.op("INTO", ops...) } func (o Opcodes) Invd(ops ...Operand) { o.a.op("INVD", ops...) } func (o Opcodes) INVD(ops ...Operand) { o.a.op("INVD", ops...) } func (o Opcodes) Invlpg(ops ...Operand) { o.a.op("INVLPG", ops...) } func (o Opcodes) INVLPG(ops ...Operand) { o.a.op("INVLPG", ops...) } func (o Opcodes) Invpcid(ops ...Operand) { o.a.op("INVPCID", ops...) } func (o Opcodes) INVPCID(ops ...Operand) { o.a.op("INVPCID", ops...) } func (o Opcodes) Inw(ops ...Operand) { o.a.op("INW", ops...) } func (o Opcodes) INW(ops ...Operand) { o.a.op("INW", ops...) } func (o Opcodes) Iretl(ops ...Operand) { o.a.op("IRETL", ops...) } func (o Opcodes) IRETL(ops ...Operand) { o.a.op("IRETL", ops...) } func (o Opcodes) Iretq(ops ...Operand) { o.a.op("IRETQ", ops...) } func (o Opcodes) IRETQ(ops ...Operand) { o.a.op("IRETQ", ops...) } func (o Opcodes) Iretw(ops ...Operand) { o.a.op("IRETW", ops...) } func (o Opcodes) IRETW(ops ...Operand) { o.a.op("IRETW", ops...) } func (o Opcodes) Jcc(ops ...Operand) { o.a.op("JCC", ops...) } func (o Opcodes) JCC(ops ...Operand) { o.a.op("JCC", ops...) } func (o Opcodes) Jcs(ops ...Operand) { o.a.op("JCS", ops...) } func (o Opcodes) JCS(ops ...Operand) { o.a.op("JCS", ops...) } func (o Opcodes) Jcxzl(ops ...Operand) { o.a.op("JCXZL", ops...) } func (o Opcodes) JCXZL(ops ...Operand) { o.a.op("JCXZL", ops...) } func (o Opcodes) Jcxzq(ops ...Operand) { o.a.op("JCXZQ", ops...) } func (o Opcodes) JCXZQ(ops ...Operand) { o.a.op("JCXZQ", ops...) } func (o Opcodes) Jcxzw(ops ...Operand) { o.a.op("JCXZW", ops...) } func (o Opcodes) JCXZW(ops ...Operand) { o.a.op("JCXZW", ops...) } func (o Opcodes) Jeq(ops ...Operand) { o.a.op("JEQ", ops...) } func (o Opcodes) JEQ(ops ...Operand) { o.a.op("JEQ", ops...) } func (o Opcodes) Jge(ops ...Operand) { o.a.op("JGE", ops...) } func (o Opcodes) JGE(ops ...Operand) { o.a.op("JGE", ops...) } func (o Opcodes) Jgt(ops ...Operand) { o.a.op("JGT", ops...) } func (o Opcodes) JGT(ops ...Operand) { o.a.op("JGT", ops...) } func (o Opcodes) Jhi(ops ...Operand) { o.a.op("JHI", ops...) } func (o Opcodes) JHI(ops ...Operand) { o.a.op("JHI", ops...) } func (o Opcodes) Jle(ops ...Operand) { o.a.op("JLE", ops...) } func (o Opcodes) JLE(ops ...Operand) { o.a.op("JLE", ops...) } func (o Opcodes) Jls(ops ...Operand) { o.a.op("JLS", ops...) } func (o Opcodes) JLS(ops ...Operand) { o.a.op("JLS", ops...) } func (o Opcodes) Jlt(ops ...Operand) { o.a.op("JLT", ops...) } func (o Opcodes) JLT(ops ...Operand) { o.a.op("JLT", ops...) } func (o Opcodes) Jmi(ops ...Operand) { o.a.op("JMI", ops...) } func (o Opcodes) JMI(ops ...Operand) { o.a.op("JMI", ops...) } func (o Opcodes) Jne(ops ...Operand) { o.a.op("JNE", ops...) } func (o Opcodes) JNE(ops ...Operand) { o.a.op("JNE", ops...) } func (o Opcodes) Joc(ops ...Operand) { o.a.op("JOC", ops...) } func (o Opcodes) JOC(ops ...Operand) { o.a.op("JOC", ops...) } func (o Opcodes) Jos(ops ...Operand) { o.a.op("JOS", ops...) } func (o Opcodes) JOS(ops ...Operand) { o.a.op("JOS", ops...) } func (o Opcodes) Jpc(ops ...Operand) { o.a.op("JPC", ops...) } func (o Opcodes) JPC(ops ...Operand) { o.a.op("JPC", ops...) } func (o Opcodes) Jpl(ops ...Operand) { o.a.op("JPL", ops...) } func (o Opcodes) JPL(ops ...Operand) { o.a.op("JPL", ops...) } func (o Opcodes) Jps(ops ...Operand) { o.a.op("JPS", ops...) } func (o Opcodes) JPS(ops ...Operand) { o.a.op("JPS", ops...) } func (o Opcodes) Kaddb(ops ...Operand) { o.a.op("KADDB", ops...) } func (o Opcodes) KADDB(ops ...Operand) { o.a.op("KADDB", ops...) } func (o Opcodes) Kaddd(ops ...Operand) { o.a.op("KADDD", ops...) } func (o Opcodes) KADDD(ops ...Operand) { o.a.op("KADDD", ops...) } func (o Opcodes) Kaddq(ops ...Operand) { o.a.op("KADDQ", ops...) } func (o Opcodes) KADDQ(ops ...Operand) { o.a.op("KADDQ", ops...) } func (o Opcodes) Kaddw(ops ...Operand) { o.a.op("KADDW", ops...) } func (o Opcodes) KADDW(ops ...Operand) { o.a.op("KADDW", ops...) } func (o Opcodes) Kandb(ops ...Operand) { o.a.op("KANDB", ops...) } func (o Opcodes) KANDB(ops ...Operand) { o.a.op("KANDB", ops...) } func (o Opcodes) Kandd(ops ...Operand) { o.a.op("KANDD", ops...) } func (o Opcodes) KANDD(ops ...Operand) { o.a.op("KANDD", ops...) } func (o Opcodes) Kandnb(ops ...Operand) { o.a.op("KANDNB", ops...) } func (o Opcodes) KANDNB(ops ...Operand) { o.a.op("KANDNB", ops...) } func (o Opcodes) Kandnd(ops ...Operand) { o.a.op("KANDND", ops...) } func (o Opcodes) KANDND(ops ...Operand) { o.a.op("KANDND", ops...) } func (o Opcodes) Kandnq(ops ...Operand) { o.a.op("KANDNQ", ops...) } func (o Opcodes) KANDNQ(ops ...Operand) { o.a.op("KANDNQ", ops...) } func (o Opcodes) Kandnw(ops ...Operand) { o.a.op("KANDNW", ops...) } func (o Opcodes) KANDNW(ops ...Operand) { o.a.op("KANDNW", ops...) } func (o Opcodes) Kandq(ops ...Operand) { o.a.op("KANDQ", ops...) } func (o Opcodes) KANDQ(ops ...Operand) { o.a.op("KANDQ", ops...) } func (o Opcodes) Kandw(ops ...Operand) { o.a.op("KANDW", ops...) } func (o Opcodes) KANDW(ops ...Operand) { o.a.op("KANDW", ops...) } func (o Opcodes) Kmovb(ops ...Operand) { o.a.op("KMOVB", ops...) } func (o Opcodes) KMOVB(ops ...Operand) { o.a.op("KMOVB", ops...) } func (o Opcodes) Kmovd(ops ...Operand) { o.a.op("KMOVD", ops...) } func (o Opcodes) KMOVD(ops ...Operand) { o.a.op("KMOVD", ops...) } func (o Opcodes) Kmovq(ops ...Operand) { o.a.op("KMOVQ", ops...) } func (o Opcodes) KMOVQ(ops ...Operand) { o.a.op("KMOVQ", ops...) } func (o Opcodes) Kmovw(ops ...Operand) { o.a.op("KMOVW", ops...) } func (o Opcodes) KMOVW(ops ...Operand) { o.a.op("KMOVW", ops...) } func (o Opcodes) Knotb(ops ...Operand) { o.a.op("KNOTB", ops...) } func (o Opcodes) KNOTB(ops ...Operand) { o.a.op("KNOTB", ops...) } func (o Opcodes) Knotd(ops ...Operand) { o.a.op("KNOTD", ops...) } func (o Opcodes) KNOTD(ops ...Operand) { o.a.op("KNOTD", ops...) } func (o Opcodes) Knotq(ops ...Operand) { o.a.op("KNOTQ", ops...) } func (o Opcodes) KNOTQ(ops ...Operand) { o.a.op("KNOTQ", ops...) } func (o Opcodes) Knotw(ops ...Operand) { o.a.op("KNOTW", ops...) } func (o Opcodes) KNOTW(ops ...Operand) { o.a.op("KNOTW", ops...) } func (o Opcodes) Korb(ops ...Operand) { o.a.op("KORB", ops...) } func (o Opcodes) KORB(ops ...Operand) { o.a.op("KORB", ops...) } func (o Opcodes) Kord(ops ...Operand) { o.a.op("KORD", ops...) } func (o Opcodes) KORD(ops ...Operand) { o.a.op("KORD", ops...) } func (o Opcodes) Korq(ops ...Operand) { o.a.op("KORQ", ops...) } func (o Opcodes) KORQ(ops ...Operand) { o.a.op("KORQ", ops...) } func (o Opcodes) Kortestb(ops ...Operand) { o.a.op("KORTESTB", ops...) } func (o Opcodes) KORTESTB(ops ...Operand) { o.a.op("KORTESTB", ops...) } func (o Opcodes) Kortestd(ops ...Operand) { o.a.op("KORTESTD", ops...) } func (o Opcodes) KORTESTD(ops ...Operand) { o.a.op("KORTESTD", ops...) } func (o Opcodes) Kortestq(ops ...Operand) { o.a.op("KORTESTQ", ops...) } func (o Opcodes) KORTESTQ(ops ...Operand) { o.a.op("KORTESTQ", ops...) } func (o Opcodes) Kortestw(ops ...Operand) { o.a.op("KORTESTW", ops...) } func (o Opcodes) KORTESTW(ops ...Operand) { o.a.op("KORTESTW", ops...) } func (o Opcodes) Korw(ops ...Operand) { o.a.op("KORW", ops...) } func (o Opcodes) KORW(ops ...Operand) { o.a.op("KORW", ops...) } func (o Opcodes) Kshiftlb(ops ...Operand) { o.a.op("KSHIFTLB", ops...) } func (o Opcodes) KSHIFTLB(ops ...Operand) { o.a.op("KSHIFTLB", ops...) } func (o Opcodes) Kshiftld(ops ...Operand) { o.a.op("KSHIFTLD", ops...) } func (o Opcodes) KSHIFTLD(ops ...Operand) { o.a.op("KSHIFTLD", ops...) } func (o Opcodes) Kshiftlq(ops ...Operand) { o.a.op("KSHIFTLQ", ops...) } func (o Opcodes) KSHIFTLQ(ops ...Operand) { o.a.op("KSHIFTLQ", ops...) } func (o Opcodes) Kshiftlw(ops ...Operand) { o.a.op("KSHIFTLW", ops...) } func (o Opcodes) KSHIFTLW(ops ...Operand) { o.a.op("KSHIFTLW", ops...) } func (o Opcodes) Kshiftrb(ops ...Operand) { o.a.op("KSHIFTRB", ops...) } func (o Opcodes) KSHIFTRB(ops ...Operand) { o.a.op("KSHIFTRB", ops...) } func (o Opcodes) Kshiftrd(ops ...Operand) { o.a.op("KSHIFTRD", ops...) } func (o Opcodes) KSHIFTRD(ops ...Operand) { o.a.op("KSHIFTRD", ops...) } func (o Opcodes) Kshiftrq(ops ...Operand) { o.a.op("KSHIFTRQ", ops...) } func (o Opcodes) KSHIFTRQ(ops ...Operand) { o.a.op("KSHIFTRQ", ops...) } func (o Opcodes) Kshiftrw(ops ...Operand) { o.a.op("KSHIFTRW", ops...) } func (o Opcodes) KSHIFTRW(ops ...Operand) { o.a.op("KSHIFTRW", ops...) } func (o Opcodes) Ktestb(ops ...Operand) { o.a.op("KTESTB", ops...) } func (o Opcodes) KTESTB(ops ...Operand) { o.a.op("KTESTB", ops...) } func (o Opcodes) Ktestd(ops ...Operand) { o.a.op("KTESTD", ops...) } func (o Opcodes) KTESTD(ops ...Operand) { o.a.op("KTESTD", ops...) } func (o Opcodes) Ktestq(ops ...Operand) { o.a.op("KTESTQ", ops...) } func (o Opcodes) KTESTQ(ops ...Operand) { o.a.op("KTESTQ", ops...) } func (o Opcodes) Ktestw(ops ...Operand) { o.a.op("KTESTW", ops...) } func (o Opcodes) KTESTW(ops ...Operand) { o.a.op("KTESTW", ops...) } func (o Opcodes) Kunpckbw(ops ...Operand) { o.a.op("KUNPCKBW", ops...) } func (o Opcodes) KUNPCKBW(ops ...Operand) { o.a.op("KUNPCKBW", ops...) } func (o Opcodes) Kunpckdq(ops ...Operand) { o.a.op("KUNPCKDQ", ops...) } func (o Opcodes) KUNPCKDQ(ops ...Operand) { o.a.op("KUNPCKDQ", ops...) } func (o Opcodes) Kunpckwd(ops ...Operand) { o.a.op("KUNPCKWD", ops...) } func (o Opcodes) KUNPCKWD(ops ...Operand) { o.a.op("KUNPCKWD", ops...) } func (o Opcodes) Kxnorb(ops ...Operand) { o.a.op("KXNORB", ops...) } func (o Opcodes) KXNORB(ops ...Operand) { o.a.op("KXNORB", ops...) } func (o Opcodes) Kxnord(ops ...Operand) { o.a.op("KXNORD", ops...) } func (o Opcodes) KXNORD(ops ...Operand) { o.a.op("KXNORD", ops...) } func (o Opcodes) Kxnorq(ops ...Operand) { o.a.op("KXNORQ", ops...) } func (o Opcodes) KXNORQ(ops ...Operand) { o.a.op("KXNORQ", ops...) } func (o Opcodes) Kxnorw(ops ...Operand) { o.a.op("KXNORW", ops...) } func (o Opcodes) KXNORW(ops ...Operand) { o.a.op("KXNORW", ops...) } func (o Opcodes) Kxorb(ops ...Operand) { o.a.op("KXORB", ops...) } func (o Opcodes) KXORB(ops ...Operand) { o.a.op("KXORB", ops...) } func (o Opcodes) Kxord(ops ...Operand) { o.a.op("KXORD", ops...) } func (o Opcodes) KXORD(ops ...Operand) { o.a.op("KXORD", ops...) } func (o Opcodes) Kxorq(ops ...Operand) { o.a.op("KXORQ", ops...) } func (o Opcodes) KXORQ(ops ...Operand) { o.a.op("KXORQ", ops...) } func (o Opcodes) Kxorw(ops ...Operand) { o.a.op("KXORW", ops...) } func (o Opcodes) KXORW(ops ...Operand) { o.a.op("KXORW", ops...) } func (o Opcodes) Lahf(ops ...Operand) { o.a.op("LAHF", ops...) } func (o Opcodes) LAHF(ops ...Operand) { o.a.op("LAHF", ops...) } func (o Opcodes) Larl(ops ...Operand) { o.a.op("LARL", ops...) } func (o Opcodes) LARL(ops ...Operand) { o.a.op("LARL", ops...) } func (o Opcodes) Larq(ops ...Operand) { o.a.op("LARQ", ops...) } func (o Opcodes) LARQ(ops ...Operand) { o.a.op("LARQ", ops...) } func (o Opcodes) Larw(ops ...Operand) { o.a.op("LARW", ops...) } func (o Opcodes) LARW(ops ...Operand) { o.a.op("LARW", ops...) } func (o Opcodes) Lddqu(ops ...Operand) { o.a.op("LDDQU", ops...) } func (o Opcodes) LDDQU(ops ...Operand) { o.a.op("LDDQU", ops...) } func (o Opcodes) Ldmxcsr(ops ...Operand) { o.a.op("LDMXCSR", ops...) } func (o Opcodes) LDMXCSR(ops ...Operand) { o.a.op("LDMXCSR", ops...) } func (o Opcodes) Leal(ops ...Operand) { o.a.op("LEAL", ops...) } func (o Opcodes) LEAL(ops ...Operand) { o.a.op("LEAL", ops...) } func (o Opcodes) Leaq(ops ...Operand) { o.a.op("LEAQ", ops...) } func (o Opcodes) LEAQ(ops ...Operand) { o.a.op("LEAQ", ops...) } func (o Opcodes) Leavel(ops ...Operand) { o.a.op("LEAVEL", ops...) } func (o Opcodes) LEAVEL(ops ...Operand) { o.a.op("LEAVEL", ops...) } func (o Opcodes) Leaveq(ops ...Operand) { o.a.op("LEAVEQ", ops...) } func (o Opcodes) LEAVEQ(ops ...Operand) { o.a.op("LEAVEQ", ops...) } func (o Opcodes) Leavew(ops ...Operand) { o.a.op("LEAVEW", ops...) } func (o Opcodes) LEAVEW(ops ...Operand) { o.a.op("LEAVEW", ops...) } func (o Opcodes) Leaw(ops ...Operand) { o.a.op("LEAW", ops...) } func (o Opcodes) LEAW(ops ...Operand) { o.a.op("LEAW", ops...) } func (o Opcodes) Lfence(ops ...Operand) { o.a.op("LFENCE", ops...) } func (o Opcodes) LFENCE(ops ...Operand) { o.a.op("LFENCE", ops...) } func (o Opcodes) Lfsl(ops ...Operand) { o.a.op("LFSL", ops...) } func (o Opcodes) LFSL(ops ...Operand) { o.a.op("LFSL", ops...) } func (o Opcodes) Lfsq(ops ...Operand) { o.a.op("LFSQ", ops...) } func (o Opcodes) LFSQ(ops ...Operand) { o.a.op("LFSQ", ops...) } func (o Opcodes) Lfsw(ops ...Operand) { o.a.op("LFSW", ops...) } func (o Opcodes) LFSW(ops ...Operand) { o.a.op("LFSW", ops...) } func (o Opcodes) Lgdt(ops ...Operand) { o.a.op("LGDT", ops...) } func (o Opcodes) LGDT(ops ...Operand) { o.a.op("LGDT", ops...) } func (o Opcodes) Lgsl(ops ...Operand) { o.a.op("LGSL", ops...) } func (o Opcodes) LGSL(ops ...Operand) { o.a.op("LGSL", ops...) } func (o Opcodes) Lgsq(ops ...Operand) { o.a.op("LGSQ", ops...) } func (o Opcodes) LGSQ(ops ...Operand) { o.a.op("LGSQ", ops...) } func (o Opcodes) Lgsw(ops ...Operand) { o.a.op("LGSW", ops...) } func (o Opcodes) LGSW(ops ...Operand) { o.a.op("LGSW", ops...) } func (o Opcodes) Lidt(ops ...Operand) { o.a.op("LIDT", ops...) } func (o Opcodes) LIDT(ops ...Operand) { o.a.op("LIDT", ops...) } func (o Opcodes) Lldt(ops ...Operand) { o.a.op("LLDT", ops...) } func (o Opcodes) LLDT(ops ...Operand) { o.a.op("LLDT", ops...) } func (o Opcodes) Lmsw(ops ...Operand) { o.a.op("LMSW", ops...) } func (o Opcodes) LMSW(ops ...Operand) { o.a.op("LMSW", ops...) } func (o Opcodes) Lock(ops ...Operand) { o.a.op("LOCK", ops...) } func (o Opcodes) LOCK(ops ...Operand) { o.a.op("LOCK", ops...) } func (o Opcodes) Lodsb(ops ...Operand) { o.a.op("LODSB", ops...) } func (o Opcodes) LODSB(ops ...Operand) { o.a.op("LODSB", ops...) } func (o Opcodes) Lodsl(ops ...Operand) { o.a.op("LODSL", ops...) } func (o Opcodes) LODSL(ops ...Operand) { o.a.op("LODSL", ops...) } func (o Opcodes) Lodsq(ops ...Operand) { o.a.op("LODSQ", ops...) } func (o Opcodes) LODSQ(ops ...Operand) { o.a.op("LODSQ", ops...) } func (o Opcodes) Lodsw(ops ...Operand) { o.a.op("LODSW", ops...) } func (o Opcodes) LODSW(ops ...Operand) { o.a.op("LODSW", ops...) } func (o Opcodes) Long(ops ...Operand) { o.a.op("LONG", ops...) } func (o Opcodes) LONG(ops ...Operand) { o.a.op("LONG", ops...) } func (o Opcodes) Loop(ops ...Operand) { o.a.op("LOOP", ops...) } func (o Opcodes) LOOP(ops ...Operand) { o.a.op("LOOP", ops...) } func (o Opcodes) Loopeq(ops ...Operand) { o.a.op("LOOPEQ", ops...) } func (o Opcodes) LOOPEQ(ops ...Operand) { o.a.op("LOOPEQ", ops...) } func (o Opcodes) Loopne(ops ...Operand) { o.a.op("LOOPNE", ops...) } func (o Opcodes) LOOPNE(ops ...Operand) { o.a.op("LOOPNE", ops...) } func (o Opcodes) Lsll(ops ...Operand) { o.a.op("LSLL", ops...) } func (o Opcodes) LSLL(ops ...Operand) { o.a.op("LSLL", ops...) } func (o Opcodes) Lslq(ops ...Operand) { o.a.op("LSLQ", ops...) } func (o Opcodes) LSLQ(ops ...Operand) { o.a.op("LSLQ", ops...) } func (o Opcodes) Lslw(ops ...Operand) { o.a.op("LSLW", ops...) } func (o Opcodes) LSLW(ops ...Operand) { o.a.op("LSLW", ops...) } func (o Opcodes) Lssl(ops ...Operand) { o.a.op("LSSL", ops...) } func (o Opcodes) LSSL(ops ...Operand) { o.a.op("LSSL", ops...) } func (o Opcodes) Lssq(ops ...Operand) { o.a.op("LSSQ", ops...) } func (o Opcodes) LSSQ(ops ...Operand) { o.a.op("LSSQ", ops...) } func (o Opcodes) Lssw(ops ...Operand) { o.a.op("LSSW", ops...) } func (o Opcodes) LSSW(ops ...Operand) { o.a.op("LSSW", ops...) } func (o Opcodes) Ltr(ops ...Operand) { o.a.op("LTR", ops...) } func (o Opcodes) LTR(ops ...Operand) { o.a.op("LTR", ops...) } func (o Opcodes) Lzcntl(ops ...Operand) { o.a.op("LZCNTL", ops...) } func (o Opcodes) LZCNTL(ops ...Operand) { o.a.op("LZCNTL", ops...) } func (o Opcodes) Lzcntq(ops ...Operand) { o.a.op("LZCNTQ", ops...) } func (o Opcodes) LZCNTQ(ops ...Operand) { o.a.op("LZCNTQ", ops...) } func (o Opcodes) Lzcntw(ops ...Operand) { o.a.op("LZCNTW", ops...) } func (o Opcodes) LZCNTW(ops ...Operand) { o.a.op("LZCNTW", ops...) } func (o Opcodes) Maskmovou(ops ...Operand) { o.a.op("MASKMOVOU", ops...) } func (o Opcodes) MASKMOVOU(ops ...Operand) { o.a.op("MASKMOVOU", ops...) } func (o Opcodes) Maskmovq(ops ...Operand) { o.a.op("MASKMOVQ", ops...) } func (o Opcodes) MASKMOVQ(ops ...Operand) { o.a.op("MASKMOVQ", ops...) } func (o Opcodes) Maxpd(ops ...Operand) { o.a.op("MAXPD", ops...) } func (o Opcodes) MAXPD(ops ...Operand) { o.a.op("MAXPD", ops...) } func (o Opcodes) Maxps(ops ...Operand) { o.a.op("MAXPS", ops...) } func (o Opcodes) MAXPS(ops ...Operand) { o.a.op("MAXPS", ops...) } func (o Opcodes) Maxsd(ops ...Operand) { o.a.op("MAXSD", ops...) } func (o Opcodes) MAXSD(ops ...Operand) { o.a.op("MAXSD", ops...) } func (o Opcodes) Maxss(ops ...Operand) { o.a.op("MAXSS", ops...) } func (o Opcodes) MAXSS(ops ...Operand) { o.a.op("MAXSS", ops...) } func (o Opcodes) Mfence(ops ...Operand) { o.a.op("MFENCE", ops...) } func (o Opcodes) MFENCE(ops ...Operand) { o.a.op("MFENCE", ops...) } func (o Opcodes) Minpd(ops ...Operand) { o.a.op("MINPD", ops...) } func (o Opcodes) MINPD(ops ...Operand) { o.a.op("MINPD", ops...) } func (o Opcodes) Minps(ops ...Operand) { o.a.op("MINPS", ops...) } func (o Opcodes) MINPS(ops ...Operand) { o.a.op("MINPS", ops...) } func (o Opcodes) Minsd(ops ...Operand) { o.a.op("MINSD", ops...) } func (o Opcodes) MINSD(ops ...Operand) { o.a.op("MINSD", ops...) } func (o Opcodes) Minss(ops ...Operand) { o.a.op("MINSS", ops...) } func (o Opcodes) MINSS(ops ...Operand) { o.a.op("MINSS", ops...) } func (o Opcodes) Monitor(ops ...Operand) { o.a.op("MONITOR", ops...) } func (o Opcodes) MONITOR(ops ...Operand) { o.a.op("MONITOR", ops...) } func (o Opcodes) Movapd(ops ...Operand) { o.a.op("MOVAPD", ops...) } func (o Opcodes) MOVAPD(ops ...Operand) { o.a.op("MOVAPD", ops...) } func (o Opcodes) Movaps(ops ...Operand) { o.a.op("MOVAPS", ops...) } func (o Opcodes) MOVAPS(ops ...Operand) { o.a.op("MOVAPS", ops...) } func (o Opcodes) Movb(ops ...Operand) { o.a.op("MOVB", ops...) } func (o Opcodes) MOVB(ops ...Operand) { o.a.op("MOVB", ops...) } func (o Opcodes) Movbell(ops ...Operand) { o.a.op("MOVBELL", ops...) } func (o Opcodes) MOVBELL(ops ...Operand) { o.a.op("MOVBELL", ops...) } func (o Opcodes) Movbeqq(ops ...Operand) { o.a.op("MOVBEQQ", ops...) } func (o Opcodes) MOVBEQQ(ops ...Operand) { o.a.op("MOVBEQQ", ops...) } func (o Opcodes) Movbeww(ops ...Operand) { o.a.op("MOVBEWW", ops...) } func (o Opcodes) MOVBEWW(ops ...Operand) { o.a.op("MOVBEWW", ops...) } func (o Opcodes) Movblsx(ops ...Operand) { o.a.op("MOVBLSX", ops...) } func (o Opcodes) MOVBLSX(ops ...Operand) { o.a.op("MOVBLSX", ops...) } func (o Opcodes) Movblzx(ops ...Operand) { o.a.op("MOVBLZX", ops...) } func (o Opcodes) MOVBLZX(ops ...Operand) { o.a.op("MOVBLZX", ops...) } func (o Opcodes) Movbqsx(ops ...Operand) { o.a.op("MOVBQSX", ops...) } func (o Opcodes) MOVBQSX(ops ...Operand) { o.a.op("MOVBQSX", ops...) } func (o Opcodes) Movbqzx(ops ...Operand) { o.a.op("MOVBQZX", ops...) } func (o Opcodes) MOVBQZX(ops ...Operand) { o.a.op("MOVBQZX", ops...) } func (o Opcodes) Movbwsx(ops ...Operand) { o.a.op("MOVBWSX", ops...) } func (o Opcodes) MOVBWSX(ops ...Operand) { o.a.op("MOVBWSX", ops...) } func (o Opcodes) Movbwzx(ops ...Operand) { o.a.op("MOVBWZX", ops...) } func (o Opcodes) MOVBWZX(ops ...Operand) { o.a.op("MOVBWZX", ops...) } func (o Opcodes) Movddup(ops ...Operand) { o.a.op("MOVDDUP", ops...) } func (o Opcodes) MOVDDUP(ops ...Operand) { o.a.op("MOVDDUP", ops...) } func (o Opcodes) Movhlps(ops ...Operand) { o.a.op("MOVHLPS", ops...) } func (o Opcodes) MOVHLPS(ops ...Operand) { o.a.op("MOVHLPS", ops...) } func (o Opcodes) Movhpd(ops ...Operand) { o.a.op("MOVHPD", ops...) } func (o Opcodes) MOVHPD(ops ...Operand) { o.a.op("MOVHPD", ops...) } func (o Opcodes) Movhps(ops ...Operand) { o.a.op("MOVHPS", ops...) } func (o Opcodes) MOVHPS(ops ...Operand) { o.a.op("MOVHPS", ops...) } func (o Opcodes) Movl(ops ...Operand) { o.a.op("MOVL", ops...) } func (o Opcodes) MOVL(ops ...Operand) { o.a.op("MOVL", ops...) } func (o Opcodes) Movlhps(ops ...Operand) { o.a.op("MOVLHPS", ops...) } func (o Opcodes) MOVLHPS(ops ...Operand) { o.a.op("MOVLHPS", ops...) } func (o Opcodes) Movlpd(ops ...Operand) { o.a.op("MOVLPD", ops...) } func (o Opcodes) MOVLPD(ops ...Operand) { o.a.op("MOVLPD", ops...) } func (o Opcodes) Movlps(ops ...Operand) { o.a.op("MOVLPS", ops...) } func (o Opcodes) MOVLPS(ops ...Operand) { o.a.op("MOVLPS", ops...) } func (o Opcodes) Movlqsx(ops ...Operand) { o.a.op("MOVLQSX", ops...) } func (o Opcodes) MOVLQSX(ops ...Operand) { o.a.op("MOVLQSX", ops...) } func (o Opcodes) Movlqzx(ops ...Operand) { o.a.op("MOVLQZX", ops...) } func (o Opcodes) MOVLQZX(ops ...Operand) { o.a.op("MOVLQZX", ops...) } func (o Opcodes) Movmskpd(ops ...Operand) { o.a.op("MOVMSKPD", ops...) } func (o Opcodes) MOVMSKPD(ops ...Operand) { o.a.op("MOVMSKPD", ops...) } func (o Opcodes) Movmskps(ops ...Operand) { o.a.op("MOVMSKPS", ops...) } func (o Opcodes) MOVMSKPS(ops ...Operand) { o.a.op("MOVMSKPS", ops...) } func (o Opcodes) Movntdqa(ops ...Operand) { o.a.op("MOVNTDQA", ops...) } func (o Opcodes) MOVNTDQA(ops ...Operand) { o.a.op("MOVNTDQA", ops...) } func (o Opcodes) Movntil(ops ...Operand) { o.a.op("MOVNTIL", ops...) } func (o Opcodes) MOVNTIL(ops ...Operand) { o.a.op("MOVNTIL", ops...) } func (o Opcodes) Movntiq(ops ...Operand) { o.a.op("MOVNTIQ", ops...) } func (o Opcodes) MOVNTIQ(ops ...Operand) { o.a.op("MOVNTIQ", ops...) } func (o Opcodes) Movnto(ops ...Operand) { o.a.op("MOVNTO", ops...) } func (o Opcodes) MOVNTO(ops ...Operand) { o.a.op("MOVNTO", ops...) } func (o Opcodes) Movntpd(ops ...Operand) { o.a.op("MOVNTPD", ops...) } func (o Opcodes) MOVNTPD(ops ...Operand) { o.a.op("MOVNTPD", ops...) } func (o Opcodes) Movntps(ops ...Operand) { o.a.op("MOVNTPS", ops...) } func (o Opcodes) MOVNTPS(ops ...Operand) { o.a.op("MOVNTPS", ops...) } func (o Opcodes) Movntq(ops ...Operand) { o.a.op("MOVNTQ", ops...) } func (o Opcodes) MOVNTQ(ops ...Operand) { o.a.op("MOVNTQ", ops...) } func (o Opcodes) Movo(ops ...Operand) { o.a.op("MOVO", ops...) } func (o Opcodes) MOVO(ops ...Operand) { o.a.op("MOVO", ops...) } func (o Opcodes) Movou(ops ...Operand) { o.a.op("MOVOU", ops...) } func (o Opcodes) MOVOU(ops ...Operand) { o.a.op("MOVOU", ops...) } func (o Opcodes) Movq(ops ...Operand) { o.a.op("MOVQ", ops...) } func (o Opcodes) MOVQ(ops ...Operand) { o.a.op("MOVQ", ops...) } func (o Opcodes) Movql(ops ...Operand) { o.a.op("MOVQL", ops...) } func (o Opcodes) MOVQL(ops ...Operand) { o.a.op("MOVQL", ops...) } func (o Opcodes) Movqozx(ops ...Operand) { o.a.op("MOVQOZX", ops...) } func (o Opcodes) MOVQOZX(ops ...Operand) { o.a.op("MOVQOZX", ops...) } func (o Opcodes) Movsb(ops ...Operand) { o.a.op("MOVSB", ops...) } func (o Opcodes) MOVSB(ops ...Operand) { o.a.op("MOVSB", ops...) } func (o Opcodes) Movsd(ops ...Operand) { o.a.op("MOVSD", ops...) } func (o Opcodes) MOVSD(ops ...Operand) { o.a.op("MOVSD", ops...) } func (o Opcodes) Movshdup(ops ...Operand) { o.a.op("MOVSHDUP", ops...) } func (o Opcodes) MOVSHDUP(ops ...Operand) { o.a.op("MOVSHDUP", ops...) } func (o Opcodes) Movsl(ops ...Operand) { o.a.op("MOVSL", ops...) } func (o Opcodes) MOVSL(ops ...Operand) { o.a.op("MOVSL", ops...) } func (o Opcodes) Movsldup(ops ...Operand) { o.a.op("MOVSLDUP", ops...) } func (o Opcodes) MOVSLDUP(ops ...Operand) { o.a.op("MOVSLDUP", ops...) } func (o Opcodes) Movsq(ops ...Operand) { o.a.op("MOVSQ", ops...) } func (o Opcodes) MOVSQ(ops ...Operand) { o.a.op("MOVSQ", ops...) } func (o Opcodes) Movss(ops ...Operand) { o.a.op("MOVSS", ops...) } func (o Opcodes) MOVSS(ops ...Operand) { o.a.op("MOVSS", ops...) } func (o Opcodes) Movsw(ops ...Operand) { o.a.op("MOVSW", ops...) } func (o Opcodes) MOVSW(ops ...Operand) { o.a.op("MOVSW", ops...) } func (o Opcodes) Movsww(ops ...Operand) { o.a.op("MOVSWW", ops...) } func (o Opcodes) MOVSWW(ops ...Operand) { o.a.op("MOVSWW", ops...) } func (o Opcodes) Movupd(ops ...Operand) { o.a.op("MOVUPD", ops...) } func (o Opcodes) MOVUPD(ops ...Operand) { o.a.op("MOVUPD", ops...) } func (o Opcodes) Movups(ops ...Operand) { o.a.op("MOVUPS", ops...) } func (o Opcodes) MOVUPS(ops ...Operand) { o.a.op("MOVUPS", ops...) } func (o Opcodes) Movw(ops ...Operand) { o.a.op("MOVW", ops...) } func (o Opcodes) MOVW(ops ...Operand) { o.a.op("MOVW", ops...) } func (o Opcodes) Movwlsx(ops ...Operand) { o.a.op("MOVWLSX", ops...) } func (o Opcodes) MOVWLSX(ops ...Operand) { o.a.op("MOVWLSX", ops...) } func (o Opcodes) Movwlzx(ops ...Operand) { o.a.op("MOVWLZX", ops...) } func (o Opcodes) MOVWLZX(ops ...Operand) { o.a.op("MOVWLZX", ops...) } func (o Opcodes) Movwqsx(ops ...Operand) { o.a.op("MOVWQSX", ops...) } func (o Opcodes) MOVWQSX(ops ...Operand) { o.a.op("MOVWQSX", ops...) } func (o Opcodes) Movwqzx(ops ...Operand) { o.a.op("MOVWQZX", ops...) } func (o Opcodes) MOVWQZX(ops ...Operand) { o.a.op("MOVWQZX", ops...) } func (o Opcodes) Movzww(ops ...Operand) { o.a.op("MOVZWW", ops...) } func (o Opcodes) MOVZWW(ops ...Operand) { o.a.op("MOVZWW", ops...) } func (o Opcodes) Mpsadbw(ops ...Operand) { o.a.op("MPSADBW", ops...) } func (o Opcodes) MPSADBW(ops ...Operand) { o.a.op("MPSADBW", ops...) } func (o Opcodes) Mulb(ops ...Operand) { o.a.op("MULB", ops...) } func (o Opcodes) MULB(ops ...Operand) { o.a.op("MULB", ops...) } func (o Opcodes) Mull(ops ...Operand) { o.a.op("MULL", ops...) } func (o Opcodes) MULL(ops ...Operand) { o.a.op("MULL", ops...) } func (o Opcodes) Mulpd(ops ...Operand) { o.a.op("MULPD", ops...) } func (o Opcodes) MULPD(ops ...Operand) { o.a.op("MULPD", ops...) } func (o Opcodes) Mulps(ops ...Operand) { o.a.op("MULPS", ops...) } func (o Opcodes) MULPS(ops ...Operand) { o.a.op("MULPS", ops...) } func (o Opcodes) Mulq(ops ...Operand) { o.a.op("MULQ", ops...) } func (o Opcodes) MULQ(ops ...Operand) { o.a.op("MULQ", ops...) } func (o Opcodes) Mulsd(ops ...Operand) { o.a.op("MULSD", ops...) } func (o Opcodes) MULSD(ops ...Operand) { o.a.op("MULSD", ops...) } func (o Opcodes) Mulss(ops ...Operand) { o.a.op("MULSS", ops...) } func (o Opcodes) MULSS(ops ...Operand) { o.a.op("MULSS", ops...) } func (o Opcodes) Mulw(ops ...Operand) { o.a.op("MULW", ops...) } func (o Opcodes) MULW(ops ...Operand) { o.a.op("MULW", ops...) } func (o Opcodes) Mulxl(ops ...Operand) { o.a.op("MULXL", ops...) } func (o Opcodes) MULXL(ops ...Operand) { o.a.op("MULXL", ops...) } func (o Opcodes) Mulxq(ops ...Operand) { o.a.op("MULXQ", ops...) } func (o Opcodes) MULXQ(ops ...Operand) { o.a.op("MULXQ", ops...) } func (o Opcodes) Mwait(ops ...Operand) { o.a.op("MWAIT", ops...) } func (o Opcodes) MWAIT(ops ...Operand) { o.a.op("MWAIT", ops...) } func (o Opcodes) Negb(ops ...Operand) { o.a.op("NEGB", ops...) } func (o Opcodes) NEGB(ops ...Operand) { o.a.op("NEGB", ops...) } func (o Opcodes) Negl(ops ...Operand) { o.a.op("NEGL", ops...) } func (o Opcodes) NEGL(ops ...Operand) { o.a.op("NEGL", ops...) } func (o Opcodes) Negq(ops ...Operand) { o.a.op("NEGQ", ops...) } func (o Opcodes) NEGQ(ops ...Operand) { o.a.op("NEGQ", ops...) } func (o Opcodes) Negw(ops ...Operand) { o.a.op("NEGW", ops...) } func (o Opcodes) NEGW(ops ...Operand) { o.a.op("NEGW", ops...) } func (o Opcodes) Nopl(ops ...Operand) { o.a.op("NOPL", ops...) } func (o Opcodes) NOPL(ops ...Operand) { o.a.op("NOPL", ops...) } func (o Opcodes) Nopw(ops ...Operand) { o.a.op("NOPW", ops...) } func (o Opcodes) NOPW(ops ...Operand) { o.a.op("NOPW", ops...) } func (o Opcodes) Notb(ops ...Operand) { o.a.op("NOTB", ops...) } func (o Opcodes) NOTB(ops ...Operand) { o.a.op("NOTB", ops...) } func (o Opcodes) Notl(ops ...Operand) { o.a.op("NOTL", ops...) } func (o Opcodes) NOTL(ops ...Operand) { o.a.op("NOTL", ops...) } func (o Opcodes) Notq(ops ...Operand) { o.a.op("NOTQ", ops...) } func (o Opcodes) NOTQ(ops ...Operand) { o.a.op("NOTQ", ops...) } func (o Opcodes) Notw(ops ...Operand) { o.a.op("NOTW", ops...) } func (o Opcodes) NOTW(ops ...Operand) { o.a.op("NOTW", ops...) } func (o Opcodes) Orb(ops ...Operand) { o.a.op("ORB", ops...) } func (o Opcodes) ORB(ops ...Operand) { o.a.op("ORB", ops...) } func (o Opcodes) Orl(ops ...Operand) { o.a.op("ORL", ops...) } func (o Opcodes) ORL(ops ...Operand) { o.a.op("ORL", ops...) } func (o Opcodes) Orpd(ops ...Operand) { o.a.op("ORPD", ops...) } func (o Opcodes) ORPD(ops ...Operand) { o.a.op("ORPD", ops...) } func (o Opcodes) Orps(ops ...Operand) { o.a.op("ORPS", ops...) } func (o Opcodes) ORPS(ops ...Operand) { o.a.op("ORPS", ops...) } func (o Opcodes) Orq(ops ...Operand) { o.a.op("ORQ", ops...) } func (o Opcodes) ORQ(ops ...Operand) { o.a.op("ORQ", ops...) } func (o Opcodes) Orw(ops ...Operand) { o.a.op("ORW", ops...) } func (o Opcodes) ORW(ops ...Operand) { o.a.op("ORW", ops...) } func (o Opcodes) Outb(ops ...Operand) { o.a.op("OUTB", ops...) } func (o Opcodes) OUTB(ops ...Operand) { o.a.op("OUTB", ops...) } func (o Opcodes) Outl(ops ...Operand) { o.a.op("OUTL", ops...) } func (o Opcodes) OUTL(ops ...Operand) { o.a.op("OUTL", ops...) } func (o Opcodes) Outsb(ops ...Operand) { o.a.op("OUTSB", ops...) } func (o Opcodes) OUTSB(ops ...Operand) { o.a.op("OUTSB", ops...) } func (o Opcodes) Outsl(ops ...Operand) { o.a.op("OUTSL", ops...) } func (o Opcodes) OUTSL(ops ...Operand) { o.a.op("OUTSL", ops...) } func (o Opcodes) Outsw(ops ...Operand) { o.a.op("OUTSW", ops...) } func (o Opcodes) OUTSW(ops ...Operand) { o.a.op("OUTSW", ops...) } func (o Opcodes) Outw(ops ...Operand) { o.a.op("OUTW", ops...) } func (o Opcodes) OUTW(ops ...Operand) { o.a.op("OUTW", ops...) } func (o Opcodes) Pabsb(ops ...Operand) { o.a.op("PABSB", ops...) } func (o Opcodes) PABSB(ops ...Operand) { o.a.op("PABSB", ops...) } func (o Opcodes) Pabsd(ops ...Operand) { o.a.op("PABSD", ops...) } func (o Opcodes) PABSD(ops ...Operand) { o.a.op("PABSD", ops...) } func (o Opcodes) Pabsw(ops ...Operand) { o.a.op("PABSW", ops...) } func (o Opcodes) PABSW(ops ...Operand) { o.a.op("PABSW", ops...) } func (o Opcodes) Packsslw(ops ...Operand) { o.a.op("PACKSSLW", ops...) } func (o Opcodes) PACKSSLW(ops ...Operand) { o.a.op("PACKSSLW", ops...) } func (o Opcodes) Packsswb(ops ...Operand) { o.a.op("PACKSSWB", ops...) } func (o Opcodes) PACKSSWB(ops ...Operand) { o.a.op("PACKSSWB", ops...) } func (o Opcodes) Packusdw(ops ...Operand) { o.a.op("PACKUSDW", ops...) } func (o Opcodes) PACKUSDW(ops ...Operand) { o.a.op("PACKUSDW", ops...) } func (o Opcodes) Packuswb(ops ...Operand) { o.a.op("PACKUSWB", ops...) } func (o Opcodes) PACKUSWB(ops ...Operand) { o.a.op("PACKUSWB", ops...) } func (o Opcodes) Paddb(ops ...Operand) { o.a.op("PADDB", ops...) } func (o Opcodes) PADDB(ops ...Operand) { o.a.op("PADDB", ops...) } func (o Opcodes) Paddl(ops ...Operand) { o.a.op("PADDL", ops...) } func (o Opcodes) PADDL(ops ...Operand) { o.a.op("PADDL", ops...) } func (o Opcodes) Paddq(ops ...Operand) { o.a.op("PADDQ", ops...) } func (o Opcodes) PADDQ(ops ...Operand) { o.a.op("PADDQ", ops...) } func (o Opcodes) Paddsb(ops ...Operand) { o.a.op("PADDSB", ops...) } func (o Opcodes) PADDSB(ops ...Operand) { o.a.op("PADDSB", ops...) } func (o Opcodes) Paddsw(ops ...Operand) { o.a.op("PADDSW", ops...) } func (o Opcodes) PADDSW(ops ...Operand) { o.a.op("PADDSW", ops...) } func (o Opcodes) Paddusb(ops ...Operand) { o.a.op("PADDUSB", ops...) } func (o Opcodes) PADDUSB(ops ...Operand) { o.a.op("PADDUSB", ops...) } func (o Opcodes) Paddusw(ops ...Operand) { o.a.op("PADDUSW", ops...) } func (o Opcodes) PADDUSW(ops ...Operand) { o.a.op("PADDUSW", ops...) } func (o Opcodes) Paddw(ops ...Operand) { o.a.op("PADDW", ops...) } func (o Opcodes) PADDW(ops ...Operand) { o.a.op("PADDW", ops...) } func (o Opcodes) Palignr(ops ...Operand) { o.a.op("PALIGNR", ops...) } func (o Opcodes) PALIGNR(ops ...Operand) { o.a.op("PALIGNR", ops...) } func (o Opcodes) Pand(ops ...Operand) { o.a.op("PAND", ops...) } func (o Opcodes) PAND(ops ...Operand) { o.a.op("PAND", ops...) } func (o Opcodes) Pandn(ops ...Operand) { o.a.op("PANDN", ops...) } func (o Opcodes) PANDN(ops ...Operand) { o.a.op("PANDN", ops...) } func (o Opcodes) Pause(ops ...Operand) { o.a.op("PAUSE", ops...) } func (o Opcodes) PAUSE(ops ...Operand) { o.a.op("PAUSE", ops...) } func (o Opcodes) Pavgb(ops ...Operand) { o.a.op("PAVGB", ops...) } func (o Opcodes) PAVGB(ops ...Operand) { o.a.op("PAVGB", ops...) } func (o Opcodes) Pavgw(ops ...Operand) { o.a.op("PAVGW", ops...) } func (o Opcodes) PAVGW(ops ...Operand) { o.a.op("PAVGW", ops...) } func (o Opcodes) Pblendvb(ops ...Operand) { o.a.op("PBLENDVB", ops...) } func (o Opcodes) PBLENDVB(ops ...Operand) { o.a.op("PBLENDVB", ops...) } func (o Opcodes) Pblendw(ops ...Operand) { o.a.op("PBLENDW", ops...) } func (o Opcodes) PBLENDW(ops ...Operand) { o.a.op("PBLENDW", ops...) } func (o Opcodes) Pclmulqdq(ops ...Operand) { o.a.op("PCLMULQDQ", ops...) } func (o Opcodes) PCLMULQDQ(ops ...Operand) { o.a.op("PCLMULQDQ", ops...) } func (o Opcodes) Pcmpeqb(ops ...Operand) { o.a.op("PCMPEQB", ops...) } func (o Opcodes) PCMPEQB(ops ...Operand) { o.a.op("PCMPEQB", ops...) } func (o Opcodes) Pcmpeql(ops ...Operand) { o.a.op("PCMPEQL", ops...) } func (o Opcodes) PCMPEQL(ops ...Operand) { o.a.op("PCMPEQL", ops...) } func (o Opcodes) Pcmpeqq(ops ...Operand) { o.a.op("PCMPEQQ", ops...) } func (o Opcodes) PCMPEQQ(ops ...Operand) { o.a.op("PCMPEQQ", ops...) } func (o Opcodes) Pcmpeqw(ops ...Operand) { o.a.op("PCMPEQW", ops...) } func (o Opcodes) PCMPEQW(ops ...Operand) { o.a.op("PCMPEQW", ops...) } func (o Opcodes) Pcmpestri(ops ...Operand) { o.a.op("PCMPESTRI", ops...) } func (o Opcodes) PCMPESTRI(ops ...Operand) { o.a.op("PCMPESTRI", ops...) } func (o Opcodes) Pcmpestrm(ops ...Operand) { o.a.op("PCMPESTRM", ops...) } func (o Opcodes) PCMPESTRM(ops ...Operand) { o.a.op("PCMPESTRM", ops...) } func (o Opcodes) Pcmpgtb(ops ...Operand) { o.a.op("PCMPGTB", ops...) } func (o Opcodes) PCMPGTB(ops ...Operand) { o.a.op("PCMPGTB", ops...) } func (o Opcodes) Pcmpgtl(ops ...Operand) { o.a.op("PCMPGTL", ops...) } func (o Opcodes) PCMPGTL(ops ...Operand) { o.a.op("PCMPGTL", ops...) } func (o Opcodes) Pcmpgtq(ops ...Operand) { o.a.op("PCMPGTQ", ops...) } func (o Opcodes) PCMPGTQ(ops ...Operand) { o.a.op("PCMPGTQ", ops...) } func (o Opcodes) Pcmpgtw(ops ...Operand) { o.a.op("PCMPGTW", ops...) } func (o Opcodes) PCMPGTW(ops ...Operand) { o.a.op("PCMPGTW", ops...) } func (o Opcodes) Pcmpistri(ops ...Operand) { o.a.op("PCMPISTRI", ops...) } func (o Opcodes) PCMPISTRI(ops ...Operand) { o.a.op("PCMPISTRI", ops...) } func (o Opcodes) Pcmpistrm(ops ...Operand) { o.a.op("PCMPISTRM", ops...) } func (o Opcodes) PCMPISTRM(ops ...Operand) { o.a.op("PCMPISTRM", ops...) } func (o Opcodes) Pdepl(ops ...Operand) { o.a.op("PDEPL", ops...) } func (o Opcodes) PDEPL(ops ...Operand) { o.a.op("PDEPL", ops...) } func (o Opcodes) Pdepq(ops ...Operand) { o.a.op("PDEPQ", ops...) } func (o Opcodes) PDEPQ(ops ...Operand) { o.a.op("PDEPQ", ops...) } func (o Opcodes) Pextl(ops ...Operand) { o.a.op("PEXTL", ops...) } func (o Opcodes) PEXTL(ops ...Operand) { o.a.op("PEXTL", ops...) } func (o Opcodes) Pextq(ops ...Operand) { o.a.op("PEXTQ", ops...) } func (o Opcodes) PEXTQ(ops ...Operand) { o.a.op("PEXTQ", ops...) } func (o Opcodes) Pextrb(ops ...Operand) { o.a.op("PEXTRB", ops...) } func (o Opcodes) PEXTRB(ops ...Operand) { o.a.op("PEXTRB", ops...) } func (o Opcodes) Pextrd(ops ...Operand) { o.a.op("PEXTRD", ops...) } func (o Opcodes) PEXTRD(ops ...Operand) { o.a.op("PEXTRD", ops...) } func (o Opcodes) Pextrq(ops ...Operand) { o.a.op("PEXTRQ", ops...) } func (o Opcodes) PEXTRQ(ops ...Operand) { o.a.op("PEXTRQ", ops...) } func (o Opcodes) Pextrw(ops ...Operand) { o.a.op("PEXTRW", ops...) } func (o Opcodes) PEXTRW(ops ...Operand) { o.a.op("PEXTRW", ops...) } func (o Opcodes) Phaddd(ops ...Operand) { o.a.op("PHADDD", ops...) } func (o Opcodes) PHADDD(ops ...Operand) { o.a.op("PHADDD", ops...) } func (o Opcodes) Phaddsw(ops ...Operand) { o.a.op("PHADDSW", ops...) } func (o Opcodes) PHADDSW(ops ...Operand) { o.a.op("PHADDSW", ops...) } func (o Opcodes) Phaddw(ops ...Operand) { o.a.op("PHADDW", ops...) } func (o Opcodes) PHADDW(ops ...Operand) { o.a.op("PHADDW", ops...) } func (o Opcodes) Phminposuw(ops ...Operand) { o.a.op("PHMINPOSUW", ops...) } func (o Opcodes) PHMINPOSUW(ops ...Operand) { o.a.op("PHMINPOSUW", ops...) } func (o Opcodes) Phsubd(ops ...Operand) { o.a.op("PHSUBD", ops...) } func (o Opcodes) PHSUBD(ops ...Operand) { o.a.op("PHSUBD", ops...) } func (o Opcodes) Phsubsw(ops ...Operand) { o.a.op("PHSUBSW", ops...) } func (o Opcodes) PHSUBSW(ops ...Operand) { o.a.op("PHSUBSW", ops...) } func (o Opcodes) Phsubw(ops ...Operand) { o.a.op("PHSUBW", ops...) } func (o Opcodes) PHSUBW(ops ...Operand) { o.a.op("PHSUBW", ops...) } func (o Opcodes) Pinsrb(ops ...Operand) { o.a.op("PINSRB", ops...) } func (o Opcodes) PINSRB(ops ...Operand) { o.a.op("PINSRB", ops...) } func (o Opcodes) Pinsrd(ops ...Operand) { o.a.op("PINSRD", ops...) } func (o Opcodes) PINSRD(ops ...Operand) { o.a.op("PINSRD", ops...) } func (o Opcodes) Pinsrq(ops ...Operand) { o.a.op("PINSRQ", ops...) } func (o Opcodes) PINSRQ(ops ...Operand) { o.a.op("PINSRQ", ops...) } func (o Opcodes) Pinsrw(ops ...Operand) { o.a.op("PINSRW", ops...) } func (o Opcodes) PINSRW(ops ...Operand) { o.a.op("PINSRW", ops...) } func (o Opcodes) Pmaddubsw(ops ...Operand) { o.a.op("PMADDUBSW", ops...) } func (o Opcodes) PMADDUBSW(ops ...Operand) { o.a.op("PMADDUBSW", ops...) } func (o Opcodes) Pmaddwl(ops ...Operand) { o.a.op("PMADDWL", ops...) } func (o Opcodes) PMADDWL(ops ...Operand) { o.a.op("PMADDWL", ops...) } func (o Opcodes) Pmaxsb(ops ...Operand) { o.a.op("PMAXSB", ops...) } func (o Opcodes) PMAXSB(ops ...Operand) { o.a.op("PMAXSB", ops...) } func (o Opcodes) Pmaxsd(ops ...Operand) { o.a.op("PMAXSD", ops...) } func (o Opcodes) PMAXSD(ops ...Operand) { o.a.op("PMAXSD", ops...) } func (o Opcodes) Pmaxsw(ops ...Operand) { o.a.op("PMAXSW", ops...) } func (o Opcodes) PMAXSW(ops ...Operand) { o.a.op("PMAXSW", ops...) } func (o Opcodes) Pmaxub(ops ...Operand) { o.a.op("PMAXUB", ops...) } func (o Opcodes) PMAXUB(ops ...Operand) { o.a.op("PMAXUB", ops...) } func (o Opcodes) Pmaxud(ops ...Operand) { o.a.op("PMAXUD", ops...) } func (o Opcodes) PMAXUD(ops ...Operand) { o.a.op("PMAXUD", ops...) } func (o Opcodes) Pmaxuw(ops ...Operand) { o.a.op("PMAXUW", ops...) } func (o Opcodes) PMAXUW(ops ...Operand) { o.a.op("PMAXUW", ops...) } func (o Opcodes) Pminsb(ops ...Operand) { o.a.op("PMINSB", ops...) } func (o Opcodes) PMINSB(ops ...Operand) { o.a.op("PMINSB", ops...) } func (o Opcodes) Pminsd(ops ...Operand) { o.a.op("PMINSD", ops...) } func (o Opcodes) PMINSD(ops ...Operand) { o.a.op("PMINSD", ops...) } func (o Opcodes) Pminsw(ops ...Operand) { o.a.op("PMINSW", ops...) } func (o Opcodes) PMINSW(ops ...Operand) { o.a.op("PMINSW", ops...) } func (o Opcodes) Pminub(ops ...Operand) { o.a.op("PMINUB", ops...) } func (o Opcodes) PMINUB(ops ...Operand) { o.a.op("PMINUB", ops...) } func (o Opcodes) Pminud(ops ...Operand) { o.a.op("PMINUD", ops...) } func (o Opcodes) PMINUD(ops ...Operand) { o.a.op("PMINUD", ops...) } func (o Opcodes) Pminuw(ops ...Operand) { o.a.op("PMINUW", ops...) } func (o Opcodes) PMINUW(ops ...Operand) { o.a.op("PMINUW", ops...) } func (o Opcodes) Pmovmskb(ops ...Operand) { o.a.op("PMOVMSKB", ops...) } func (o Opcodes) PMOVMSKB(ops ...Operand) { o.a.op("PMOVMSKB", ops...) } func (o Opcodes) Pmovsxbd(ops ...Operand) { o.a.op("PMOVSXBD", ops...) } func (o Opcodes) PMOVSXBD(ops ...Operand) { o.a.op("PMOVSXBD", ops...) } func (o Opcodes) Pmovsxbq(ops ...Operand) { o.a.op("PMOVSXBQ", ops...) } func (o Opcodes) PMOVSXBQ(ops ...Operand) { o.a.op("PMOVSXBQ", ops...) } func (o Opcodes) Pmovsxbw(ops ...Operand) { o.a.op("PMOVSXBW", ops...) } func (o Opcodes) PMOVSXBW(ops ...Operand) { o.a.op("PMOVSXBW", ops...) } func (o Opcodes) Pmovsxdq(ops ...Operand) { o.a.op("PMOVSXDQ", ops...) } func (o Opcodes) PMOVSXDQ(ops ...Operand) { o.a.op("PMOVSXDQ", ops...) } func (o Opcodes) Pmovsxwd(ops ...Operand) { o.a.op("PMOVSXWD", ops...) } func (o Opcodes) PMOVSXWD(ops ...Operand) { o.a.op("PMOVSXWD", ops...) } func (o Opcodes) Pmovsxwq(ops ...Operand) { o.a.op("PMOVSXWQ", ops...) } func (o Opcodes) PMOVSXWQ(ops ...Operand) { o.a.op("PMOVSXWQ", ops...) } func (o Opcodes) Pmovzxbd(ops ...Operand) { o.a.op("PMOVZXBD", ops...) } func (o Opcodes) PMOVZXBD(ops ...Operand) { o.a.op("PMOVZXBD", ops...) } func (o Opcodes) Pmovzxbq(ops ...Operand) { o.a.op("PMOVZXBQ", ops...) } func (o Opcodes) PMOVZXBQ(ops ...Operand) { o.a.op("PMOVZXBQ", ops...) } func (o Opcodes) Pmovzxbw(ops ...Operand) { o.a.op("PMOVZXBW", ops...) } func (o Opcodes) PMOVZXBW(ops ...Operand) { o.a.op("PMOVZXBW", ops...) } func (o Opcodes) Pmovzxdq(ops ...Operand) { o.a.op("PMOVZXDQ", ops...) } func (o Opcodes) PMOVZXDQ(ops ...Operand) { o.a.op("PMOVZXDQ", ops...) } func (o Opcodes) Pmovzxwd(ops ...Operand) { o.a.op("PMOVZXWD", ops...) } func (o Opcodes) PMOVZXWD(ops ...Operand) { o.a.op("PMOVZXWD", ops...) } func (o Opcodes) Pmovzxwq(ops ...Operand) { o.a.op("PMOVZXWQ", ops...) } func (o Opcodes) PMOVZXWQ(ops ...Operand) { o.a.op("PMOVZXWQ", ops...) } func (o Opcodes) Pmuldq(ops ...Operand) { o.a.op("PMULDQ", ops...) } func (o Opcodes) PMULDQ(ops ...Operand) { o.a.op("PMULDQ", ops...) } func (o Opcodes) Pmulhrsw(ops ...Operand) { o.a.op("PMULHRSW", ops...) } func (o Opcodes) PMULHRSW(ops ...Operand) { o.a.op("PMULHRSW", ops...) } func (o Opcodes) Pmulhuw(ops ...Operand) { o.a.op("PMULHUW", ops...) } func (o Opcodes) PMULHUW(ops ...Operand) { o.a.op("PMULHUW", ops...) } func (o Opcodes) Pmulhw(ops ...Operand) { o.a.op("PMULHW", ops...) } func (o Opcodes) PMULHW(ops ...Operand) { o.a.op("PMULHW", ops...) } func (o Opcodes) Pmulld(ops ...Operand) { o.a.op("PMULLD", ops...) } func (o Opcodes) PMULLD(ops ...Operand) { o.a.op("PMULLD", ops...) } func (o Opcodes) Pmullw(ops ...Operand) { o.a.op("PMULLW", ops...) } func (o Opcodes) PMULLW(ops ...Operand) { o.a.op("PMULLW", ops...) } func (o Opcodes) Pmululq(ops ...Operand) { o.a.op("PMULULQ", ops...) } func (o Opcodes) PMULULQ(ops ...Operand) { o.a.op("PMULULQ", ops...) } func (o Opcodes) Popal(ops ...Operand) { o.a.op("POPAL", ops...) } func (o Opcodes) POPAL(ops ...Operand) { o.a.op("POPAL", ops...) } func (o Opcodes) Popaw(ops ...Operand) { o.a.op("POPAW", ops...) } func (o Opcodes) POPAW(ops ...Operand) { o.a.op("POPAW", ops...) } func (o Opcodes) Popcntl(ops ...Operand) { o.a.op("POPCNTL", ops...) } func (o Opcodes) POPCNTL(ops ...Operand) { o.a.op("POPCNTL", ops...) } func (o Opcodes) Popcntq(ops ...Operand) { o.a.op("POPCNTQ", ops...) } func (o Opcodes) POPCNTQ(ops ...Operand) { o.a.op("POPCNTQ", ops...) } func (o Opcodes) Popcntw(ops ...Operand) { o.a.op("POPCNTW", ops...) } func (o Opcodes) POPCNTW(ops ...Operand) { o.a.op("POPCNTW", ops...) } func (o Opcodes) Popfl(ops ...Operand) { o.a.op("POPFL", ops...) } func (o Opcodes) POPFL(ops ...Operand) { o.a.op("POPFL", ops...) } func (o Opcodes) Popfq(ops ...Operand) { o.a.op("POPFQ", ops...) } func (o Opcodes) POPFQ(ops ...Operand) { o.a.op("POPFQ", ops...) } func (o Opcodes) Popfw(ops ...Operand) { o.a.op("POPFW", ops...) } func (o Opcodes) POPFW(ops ...Operand) { o.a.op("POPFW", ops...) } func (o Opcodes) Popl(ops ...Operand) { o.a.op("POPL", ops...) } func (o Opcodes) POPL(ops ...Operand) { o.a.op("POPL", ops...) } func (o Opcodes) Popq(ops ...Operand) { o.a.op("POPQ", ops...) } func (o Opcodes) POPQ(ops ...Operand) { o.a.op("POPQ", ops...) } func (o Opcodes) Popw(ops ...Operand) { o.a.op("POPW", ops...) } func (o Opcodes) POPW(ops ...Operand) { o.a.op("POPW", ops...) } func (o Opcodes) Por(ops ...Operand) { o.a.op("POR", ops...) } func (o Opcodes) POR(ops ...Operand) { o.a.op("POR", ops...) } func (o Opcodes) Prefetchnta(ops ...Operand) { o.a.op("PREFETCHNTA", ops...) } func (o Opcodes) PREFETCHNTA(ops ...Operand) { o.a.op("PREFETCHNTA", ops...) } func (o Opcodes) Prefetcht0(ops ...Operand) { o.a.op("PREFETCHT0", ops...) } func (o Opcodes) PREFETCHT0(ops ...Operand) { o.a.op("PREFETCHT0", ops...) } func (o Opcodes) Prefetcht1(ops ...Operand) { o.a.op("PREFETCHT1", ops...) } func (o Opcodes) PREFETCHT1(ops ...Operand) { o.a.op("PREFETCHT1", ops...) } func (o Opcodes) Prefetcht2(ops ...Operand) { o.a.op("PREFETCHT2", ops...) } func (o Opcodes) PREFETCHT2(ops ...Operand) { o.a.op("PREFETCHT2", ops...) } func (o Opcodes) Psadbw(ops ...Operand) { o.a.op("PSADBW", ops...) } func (o Opcodes) PSADBW(ops ...Operand) { o.a.op("PSADBW", ops...) } func (o Opcodes) Pshufb(ops ...Operand) { o.a.op("PSHUFB", ops...) } func (o Opcodes) PSHUFB(ops ...Operand) { o.a.op("PSHUFB", ops...) } func (o Opcodes) Pshufd(ops ...Operand) { o.a.op("PSHUFD", ops...) } func (o Opcodes) PSHUFD(ops ...Operand) { o.a.op("PSHUFD", ops...) } func (o Opcodes) Pshufhw(ops ...Operand) { o.a.op("PSHUFHW", ops...) } func (o Opcodes) PSHUFHW(ops ...Operand) { o.a.op("PSHUFHW", ops...) } func (o Opcodes) Pshufl(ops ...Operand) { o.a.op("PSHUFL", ops...) } func (o Opcodes) PSHUFL(ops ...Operand) { o.a.op("PSHUFL", ops...) } func (o Opcodes) Pshuflw(ops ...Operand) { o.a.op("PSHUFLW", ops...) } func (o Opcodes) PSHUFLW(ops ...Operand) { o.a.op("PSHUFLW", ops...) } func (o Opcodes) Pshufw(ops ...Operand) { o.a.op("PSHUFW", ops...) } func (o Opcodes) PSHUFW(ops ...Operand) { o.a.op("PSHUFW", ops...) } func (o Opcodes) Psignb(ops ...Operand) { o.a.op("PSIGNB", ops...) } func (o Opcodes) PSIGNB(ops ...Operand) { o.a.op("PSIGNB", ops...) } func (o Opcodes) Psignd(ops ...Operand) { o.a.op("PSIGND", ops...) } func (o Opcodes) PSIGND(ops ...Operand) { o.a.op("PSIGND", ops...) } func (o Opcodes) Psignw(ops ...Operand) { o.a.op("PSIGNW", ops...) } func (o Opcodes) PSIGNW(ops ...Operand) { o.a.op("PSIGNW", ops...) } func (o Opcodes) Pslll(ops ...Operand) { o.a.op("PSLLL", ops...) } func (o Opcodes) PSLLL(ops ...Operand) { o.a.op("PSLLL", ops...) } func (o Opcodes) Psllo(ops ...Operand) { o.a.op("PSLLO", ops...) } func (o Opcodes) PSLLO(ops ...Operand) { o.a.op("PSLLO", ops...) } func (o Opcodes) Psllq(ops ...Operand) { o.a.op("PSLLQ", ops...) } func (o Opcodes) PSLLQ(ops ...Operand) { o.a.op("PSLLQ", ops...) } func (o Opcodes) Psllw(ops ...Operand) { o.a.op("PSLLW", ops...) } func (o Opcodes) PSLLW(ops ...Operand) { o.a.op("PSLLW", ops...) } func (o Opcodes) Psral(ops ...Operand) { o.a.op("PSRAL", ops...) } func (o Opcodes) PSRAL(ops ...Operand) { o.a.op("PSRAL", ops...) } func (o Opcodes) Psraw(ops ...Operand) { o.a.op("PSRAW", ops...) } func (o Opcodes) PSRAW(ops ...Operand) { o.a.op("PSRAW", ops...) } func (o Opcodes) Psrll(ops ...Operand) { o.a.op("PSRLL", ops...) } func (o Opcodes) PSRLL(ops ...Operand) { o.a.op("PSRLL", ops...) } func (o Opcodes) Psrlo(ops ...Operand) { o.a.op("PSRLO", ops...) } func (o Opcodes) PSRLO(ops ...Operand) { o.a.op("PSRLO", ops...) } func (o Opcodes) Psrlq(ops ...Operand) { o.a.op("PSRLQ", ops...) } func (o Opcodes) PSRLQ(ops ...Operand) { o.a.op("PSRLQ", ops...) } func (o Opcodes) Psrlw(ops ...Operand) { o.a.op("PSRLW", ops...) } func (o Opcodes) PSRLW(ops ...Operand) { o.a.op("PSRLW", ops...) } func (o Opcodes) Psubb(ops ...Operand) { o.a.op("PSUBB", ops...) } func (o Opcodes) PSUBB(ops ...Operand) { o.a.op("PSUBB", ops...) } func (o Opcodes) Psubl(ops ...Operand) { o.a.op("PSUBL", ops...) } func (o Opcodes) PSUBL(ops ...Operand) { o.a.op("PSUBL", ops...) } func (o Opcodes) Psubq(ops ...Operand) { o.a.op("PSUBQ", ops...) } func (o Opcodes) PSUBQ(ops ...Operand) { o.a.op("PSUBQ", ops...) } func (o Opcodes) Psubsb(ops ...Operand) { o.a.op("PSUBSB", ops...) } func (o Opcodes) PSUBSB(ops ...Operand) { o.a.op("PSUBSB", ops...) } func (o Opcodes) Psubsw(ops ...Operand) { o.a.op("PSUBSW", ops...) } func (o Opcodes) PSUBSW(ops ...Operand) { o.a.op("PSUBSW", ops...) } func (o Opcodes) Psubusb(ops ...Operand) { o.a.op("PSUBUSB", ops...) } func (o Opcodes) PSUBUSB(ops ...Operand) { o.a.op("PSUBUSB", ops...) } func (o Opcodes) Psubusw(ops ...Operand) { o.a.op("PSUBUSW", ops...) } func (o Opcodes) PSUBUSW(ops ...Operand) { o.a.op("PSUBUSW", ops...) } func (o Opcodes) Psubw(ops ...Operand) { o.a.op("PSUBW", ops...) } func (o Opcodes) PSUBW(ops ...Operand) { o.a.op("PSUBW", ops...) } func (o Opcodes) Ptest(ops ...Operand) { o.a.op("PTEST", ops...) } func (o Opcodes) PTEST(ops ...Operand) { o.a.op("PTEST", ops...) } func (o Opcodes) Punpckhbw(ops ...Operand) { o.a.op("PUNPCKHBW", ops...) } func (o Opcodes) PUNPCKHBW(ops ...Operand) { o.a.op("PUNPCKHBW", ops...) } func (o Opcodes) Punpckhlq(ops ...Operand) { o.a.op("PUNPCKHLQ", ops...) } func (o Opcodes) PUNPCKHLQ(ops ...Operand) { o.a.op("PUNPCKHLQ", ops...) } func (o Opcodes) Punpckhqdq(ops ...Operand) { o.a.op("PUNPCKHQDQ", ops...) } func (o Opcodes) PUNPCKHQDQ(ops ...Operand) { o.a.op("PUNPCKHQDQ", ops...) } func (o Opcodes) Punpckhwl(ops ...Operand) { o.a.op("PUNPCKHWL", ops...) } func (o Opcodes) PUNPCKHWL(ops ...Operand) { o.a.op("PUNPCKHWL", ops...) } func (o Opcodes) Punpcklbw(ops ...Operand) { o.a.op("PUNPCKLBW", ops...) } func (o Opcodes) PUNPCKLBW(ops ...Operand) { o.a.op("PUNPCKLBW", ops...) } func (o Opcodes) Punpckllq(ops ...Operand) { o.a.op("PUNPCKLLQ", ops...) } func (o Opcodes) PUNPCKLLQ(ops ...Operand) { o.a.op("PUNPCKLLQ", ops...) } func (o Opcodes) Punpcklqdq(ops ...Operand) { o.a.op("PUNPCKLQDQ", ops...) } func (o Opcodes) PUNPCKLQDQ(ops ...Operand) { o.a.op("PUNPCKLQDQ", ops...) } func (o Opcodes) Punpcklwl(ops ...Operand) { o.a.op("PUNPCKLWL", ops...) } func (o Opcodes) PUNPCKLWL(ops ...Operand) { o.a.op("PUNPCKLWL", ops...) } func (o Opcodes) Pushal(ops ...Operand) { o.a.op("PUSHAL", ops...) } func (o Opcodes) PUSHAL(ops ...Operand) { o.a.op("PUSHAL", ops...) } func (o Opcodes) Pushaw(ops ...Operand) { o.a.op("PUSHAW", ops...) } func (o Opcodes) PUSHAW(ops ...Operand) { o.a.op("PUSHAW", ops...) } func (o Opcodes) Pushfl(ops ...Operand) { o.a.op("PUSHFL", ops...) } func (o Opcodes) PUSHFL(ops ...Operand) { o.a.op("PUSHFL", ops...) } func (o Opcodes) Pushfq(ops ...Operand) { o.a.op("PUSHFQ", ops...) } func (o Opcodes) PUSHFQ(ops ...Operand) { o.a.op("PUSHFQ", ops...) } func (o Opcodes) Pushfw(ops ...Operand) { o.a.op("PUSHFW", ops...) } func (o Opcodes) PUSHFW(ops ...Operand) { o.a.op("PUSHFW", ops...) } func (o Opcodes) Pushl(ops ...Operand) { o.a.op("PUSHL", ops...) } func (o Opcodes) PUSHL(ops ...Operand) { o.a.op("PUSHL", ops...) } func (o Opcodes) Pushq(ops ...Operand) { o.a.op("PUSHQ", ops...) } func (o Opcodes) PUSHQ(ops ...Operand) { o.a.op("PUSHQ", ops...) } func (o Opcodes) Pushw(ops ...Operand) { o.a.op("PUSHW", ops...) } func (o Opcodes) PUSHW(ops ...Operand) { o.a.op("PUSHW", ops...) } func (o Opcodes) Pxor(ops ...Operand) { o.a.op("PXOR", ops...) } func (o Opcodes) PXOR(ops ...Operand) { o.a.op("PXOR", ops...) } func (o Opcodes) Quad(ops ...Operand) { o.a.op("QUAD", ops...) } func (o Opcodes) QUAD(ops ...Operand) { o.a.op("QUAD", ops...) } func (o Opcodes) Rclb(ops ...Operand) { o.a.op("RCLB", ops...) } func (o Opcodes) RCLB(ops ...Operand) { o.a.op("RCLB", ops...) } func (o Opcodes) Rcll(ops ...Operand) { o.a.op("RCLL", ops...) } func (o Opcodes) RCLL(ops ...Operand) { o.a.op("RCLL", ops...) } func (o Opcodes) Rclq(ops ...Operand) { o.a.op("RCLQ", ops...) } func (o Opcodes) RCLQ(ops ...Operand) { o.a.op("RCLQ", ops...) } func (o Opcodes) Rclw(ops ...Operand) { o.a.op("RCLW", ops...) } func (o Opcodes) RCLW(ops ...Operand) { o.a.op("RCLW", ops...) } func (o Opcodes) Rcpps(ops ...Operand) { o.a.op("RCPPS", ops...) } func (o Opcodes) RCPPS(ops ...Operand) { o.a.op("RCPPS", ops...) } func (o Opcodes) Rcpss(ops ...Operand) { o.a.op("RCPSS", ops...) } func (o Opcodes) RCPSS(ops ...Operand) { o.a.op("RCPSS", ops...) } func (o Opcodes) Rcrb(ops ...Operand) { o.a.op("RCRB", ops...) } func (o Opcodes) RCRB(ops ...Operand) { o.a.op("RCRB", ops...) } func (o Opcodes) Rcrl(ops ...Operand) { o.a.op("RCRL", ops...) } func (o Opcodes) RCRL(ops ...Operand) { o.a.op("RCRL", ops...) } func (o Opcodes) Rcrq(ops ...Operand) { o.a.op("RCRQ", ops...) } func (o Opcodes) RCRQ(ops ...Operand) { o.a.op("RCRQ", ops...) } func (o Opcodes) Rcrw(ops ...Operand) { o.a.op("RCRW", ops...) } func (o Opcodes) RCRW(ops ...Operand) { o.a.op("RCRW", ops...) } func (o Opcodes) Rdfsbasel(ops ...Operand) { o.a.op("RDFSBASEL", ops...) } func (o Opcodes) RDFSBASEL(ops ...Operand) { o.a.op("RDFSBASEL", ops...) } func (o Opcodes) Rdfsbaseq(ops ...Operand) { o.a.op("RDFSBASEQ", ops...) } func (o Opcodes) RDFSBASEQ(ops ...Operand) { o.a.op("RDFSBASEQ", ops...) } func (o Opcodes) Rdgsbasel(ops ...Operand) { o.a.op("RDGSBASEL", ops...) } func (o Opcodes) RDGSBASEL(ops ...Operand) { o.a.op("RDGSBASEL", ops...) } func (o Opcodes) Rdgsbaseq(ops ...Operand) { o.a.op("RDGSBASEQ", ops...) } func (o Opcodes) RDGSBASEQ(ops ...Operand) { o.a.op("RDGSBASEQ", ops...) } func (o Opcodes) Rdmsr(ops ...Operand) { o.a.op("RDMSR", ops...) } func (o Opcodes) RDMSR(ops ...Operand) { o.a.op("RDMSR", ops...) } func (o Opcodes) Rdpkru(ops ...Operand) { o.a.op("RDPKRU", ops...) } func (o Opcodes) RDPKRU(ops ...Operand) { o.a.op("RDPKRU", ops...) } func (o Opcodes) Rdpmc(ops ...Operand) { o.a.op("RDPMC", ops...) } func (o Opcodes) RDPMC(ops ...Operand) { o.a.op("RDPMC", ops...) } func (o Opcodes) Rdrandl(ops ...Operand) { o.a.op("RDRANDL", ops...) } func (o Opcodes) RDRANDL(ops ...Operand) { o.a.op("RDRANDL", ops...) } func (o Opcodes) Rdrandq(ops ...Operand) { o.a.op("RDRANDQ", ops...) } func (o Opcodes) RDRANDQ(ops ...Operand) { o.a.op("RDRANDQ", ops...) } func (o Opcodes) Rdrandw(ops ...Operand) { o.a.op("RDRANDW", ops...) } func (o Opcodes) RDRANDW(ops ...Operand) { o.a.op("RDRANDW", ops...) } func (o Opcodes) Rdseedl(ops ...Operand) { o.a.op("RDSEEDL", ops...) } func (o Opcodes) RDSEEDL(ops ...Operand) { o.a.op("RDSEEDL", ops...) } func (o Opcodes) Rdseedq(ops ...Operand) { o.a.op("RDSEEDQ", ops...) } func (o Opcodes) RDSEEDQ(ops ...Operand) { o.a.op("RDSEEDQ", ops...) } func (o Opcodes) Rdseedw(ops ...Operand) { o.a.op("RDSEEDW", ops...) } func (o Opcodes) RDSEEDW(ops ...Operand) { o.a.op("RDSEEDW", ops...) } func (o Opcodes) Rdtsc(ops ...Operand) { o.a.op("RDTSC", ops...) } func (o Opcodes) RDTSC(ops ...Operand) { o.a.op("RDTSC", ops...) } func (o Opcodes) Rdtscp(ops ...Operand) { o.a.op("RDTSCP", ops...) } func (o Opcodes) RDTSCP(ops ...Operand) { o.a.op("RDTSCP", ops...) } func (o Opcodes) Rep(ops ...Operand) { o.a.op("REP", ops...) } func (o Opcodes) REP(ops ...Operand) { o.a.op("REP", ops...) } func (o Opcodes) Repn(ops ...Operand) { o.a.op("REPN", ops...) } func (o Opcodes) REPN(ops ...Operand) { o.a.op("REPN", ops...) } func (o Opcodes) Retfl(ops ...Operand) { o.a.op("RETFL", ops...) } func (o Opcodes) RETFL(ops ...Operand) { o.a.op("RETFL", ops...) } func (o Opcodes) Retfq(ops ...Operand) { o.a.op("RETFQ", ops...) } func (o Opcodes) RETFQ(ops ...Operand) { o.a.op("RETFQ", ops...) } func (o Opcodes) Retfw(ops ...Operand) { o.a.op("RETFW", ops...) } func (o Opcodes) RETFW(ops ...Operand) { o.a.op("RETFW", ops...) } func (o Opcodes) Rolb(ops ...Operand) { o.a.op("ROLB", ops...) } func (o Opcodes) ROLB(ops ...Operand) { o.a.op("ROLB", ops...) } func (o Opcodes) Roll(ops ...Operand) { o.a.op("ROLL", ops...) } func (o Opcodes) ROLL(ops ...Operand) { o.a.op("ROLL", ops...) } func (o Opcodes) Rolq(ops ...Operand) { o.a.op("ROLQ", ops...) } func (o Opcodes) ROLQ(ops ...Operand) { o.a.op("ROLQ", ops...) } func (o Opcodes) Rolw(ops ...Operand) { o.a.op("ROLW", ops...) } func (o Opcodes) ROLW(ops ...Operand) { o.a.op("ROLW", ops...) } func (o Opcodes) Rorb(ops ...Operand) { o.a.op("RORB", ops...) } func (o Opcodes) RORB(ops ...Operand) { o.a.op("RORB", ops...) } func (o Opcodes) Rorl(ops ...Operand) { o.a.op("RORL", ops...) } func (o Opcodes) RORL(ops ...Operand) { o.a.op("RORL", ops...) } func (o Opcodes) Rorq(ops ...Operand) { o.a.op("RORQ", ops...) } func (o Opcodes) RORQ(ops ...Operand) { o.a.op("RORQ", ops...) } func (o Opcodes) Rorw(ops ...Operand) { o.a.op("RORW", ops...) } func (o Opcodes) RORW(ops ...Operand) { o.a.op("RORW", ops...) } func (o Opcodes) Rorxl(ops ...Operand) { o.a.op("RORXL", ops...) } func (o Opcodes) RORXL(ops ...Operand) { o.a.op("RORXL", ops...) } func (o Opcodes) Rorxq(ops ...Operand) { o.a.op("RORXQ", ops...) } func (o Opcodes) RORXQ(ops ...Operand) { o.a.op("RORXQ", ops...) } func (o Opcodes) Roundpd(ops ...Operand) { o.a.op("ROUNDPD", ops...) } func (o Opcodes) ROUNDPD(ops ...Operand) { o.a.op("ROUNDPD", ops...) } func (o Opcodes) Roundps(ops ...Operand) { o.a.op("ROUNDPS", ops...) } func (o Opcodes) ROUNDPS(ops ...Operand) { o.a.op("ROUNDPS", ops...) } func (o Opcodes) Roundsd(ops ...Operand) { o.a.op("ROUNDSD", ops...) } func (o Opcodes) ROUNDSD(ops ...Operand) { o.a.op("ROUNDSD", ops...) } func (o Opcodes) Roundss(ops ...Operand) { o.a.op("ROUNDSS", ops...) } func (o Opcodes) ROUNDSS(ops ...Operand) { o.a.op("ROUNDSS", ops...) } func (o Opcodes) Rsm(ops ...Operand) { o.a.op("RSM", ops...) } func (o Opcodes) RSM(ops ...Operand) { o.a.op("RSM", ops...) } func (o Opcodes) Rsqrtps(ops ...Operand) { o.a.op("RSQRTPS", ops...) } func (o Opcodes) RSQRTPS(ops ...Operand) { o.a.op("RSQRTPS", ops...) } func (o Opcodes) Rsqrtss(ops ...Operand) { o.a.op("RSQRTSS", ops...) } func (o Opcodes) RSQRTSS(ops ...Operand) { o.a.op("RSQRTSS", ops...) } func (o Opcodes) Sahf(ops ...Operand) { o.a.op("SAHF", ops...) } func (o Opcodes) SAHF(ops ...Operand) { o.a.op("SAHF", ops...) } func (o Opcodes) Salb(ops ...Operand) { o.a.op("SALB", ops...) } func (o Opcodes) SALB(ops ...Operand) { o.a.op("SALB", ops...) } func (o Opcodes) Sall(ops ...Operand) { o.a.op("SALL", ops...) } func (o Opcodes) SALL(ops ...Operand) { o.a.op("SALL", ops...) } func (o Opcodes) Salq(ops ...Operand) { o.a.op("SALQ", ops...) } func (o Opcodes) SALQ(ops ...Operand) { o.a.op("SALQ", ops...) } func (o Opcodes) Salw(ops ...Operand) { o.a.op("SALW", ops...) } func (o Opcodes) SALW(ops ...Operand) { o.a.op("SALW", ops...) } func (o Opcodes) Sarb(ops ...Operand) { o.a.op("SARB", ops...) } func (o Opcodes) SARB(ops ...Operand) { o.a.op("SARB", ops...) } func (o Opcodes) Sarl(ops ...Operand) { o.a.op("SARL", ops...) } func (o Opcodes) SARL(ops ...Operand) { o.a.op("SARL", ops...) } func (o Opcodes) Sarq(ops ...Operand) { o.a.op("SARQ", ops...) } func (o Opcodes) SARQ(ops ...Operand) { o.a.op("SARQ", ops...) } func (o Opcodes) Sarw(ops ...Operand) { o.a.op("SARW", ops...) } func (o Opcodes) SARW(ops ...Operand) { o.a.op("SARW", ops...) } func (o Opcodes) Sarxl(ops ...Operand) { o.a.op("SARXL", ops...) } func (o Opcodes) SARXL(ops ...Operand) { o.a.op("SARXL", ops...) } func (o Opcodes) Sarxq(ops ...Operand) { o.a.op("SARXQ", ops...) } func (o Opcodes) SARXQ(ops ...Operand) { o.a.op("SARXQ", ops...) } func (o Opcodes) Sbbb(ops ...Operand) { o.a.op("SBBB", ops...) } func (o Opcodes) SBBB(ops ...Operand) { o.a.op("SBBB", ops...) } func (o Opcodes) Sbbl(ops ...Operand) { o.a.op("SBBL", ops...) } func (o Opcodes) SBBL(ops ...Operand) { o.a.op("SBBL", ops...) } func (o Opcodes) Sbbq(ops ...Operand) { o.a.op("SBBQ", ops...) } func (o Opcodes) SBBQ(ops ...Operand) { o.a.op("SBBQ", ops...) } func (o Opcodes) Sbbw(ops ...Operand) { o.a.op("SBBW", ops...) } func (o Opcodes) SBBW(ops ...Operand) { o.a.op("SBBW", ops...) } func (o Opcodes) Scasb(ops ...Operand) { o.a.op("SCASB", ops...) } func (o Opcodes) SCASB(ops ...Operand) { o.a.op("SCASB", ops...) } func (o Opcodes) Scasl(ops ...Operand) { o.a.op("SCASL", ops...) } func (o Opcodes) SCASL(ops ...Operand) { o.a.op("SCASL", ops...) } func (o Opcodes) Scasq(ops ...Operand) { o.a.op("SCASQ", ops...) } func (o Opcodes) SCASQ(ops ...Operand) { o.a.op("SCASQ", ops...) } func (o Opcodes) Scasw(ops ...Operand) { o.a.op("SCASW", ops...) } func (o Opcodes) SCASW(ops ...Operand) { o.a.op("SCASW", ops...) } func (o Opcodes) Setcc(ops ...Operand) { o.a.op("SETCC", ops...) } func (o Opcodes) SETCC(ops ...Operand) { o.a.op("SETCC", ops...) } func (o Opcodes) Setcs(ops ...Operand) { o.a.op("SETCS", ops...) } func (o Opcodes) SETCS(ops ...Operand) { o.a.op("SETCS", ops...) } func (o Opcodes) Seteq(ops ...Operand) { o.a.op("SETEQ", ops...) } func (o Opcodes) SETEQ(ops ...Operand) { o.a.op("SETEQ", ops...) } func (o Opcodes) Setge(ops ...Operand) { o.a.op("SETGE", ops...) } func (o Opcodes) SETGE(ops ...Operand) { o.a.op("SETGE", ops...) } func (o Opcodes) Setgt(ops ...Operand) { o.a.op("SETGT", ops...) } func (o Opcodes) SETGT(ops ...Operand) { o.a.op("SETGT", ops...) } func (o Opcodes) Sethi(ops ...Operand) { o.a.op("SETHI", ops...) } func (o Opcodes) SETHI(ops ...Operand) { o.a.op("SETHI", ops...) } func (o Opcodes) Setle(ops ...Operand) { o.a.op("SETLE", ops...) } func (o Opcodes) SETLE(ops ...Operand) { o.a.op("SETLE", ops...) } func (o Opcodes) Setls(ops ...Operand) { o.a.op("SETLS", ops...) } func (o Opcodes) SETLS(ops ...Operand) { o.a.op("SETLS", ops...) } func (o Opcodes) Setlt(ops ...Operand) { o.a.op("SETLT", ops...) } func (o Opcodes) SETLT(ops ...Operand) { o.a.op("SETLT", ops...) } func (o Opcodes) Setmi(ops ...Operand) { o.a.op("SETMI", ops...) } func (o Opcodes) SETMI(ops ...Operand) { o.a.op("SETMI", ops...) } func (o Opcodes) Setne(ops ...Operand) { o.a.op("SETNE", ops...) } func (o Opcodes) SETNE(ops ...Operand) { o.a.op("SETNE", ops...) } func (o Opcodes) Setoc(ops ...Operand) { o.a.op("SETOC", ops...) } func (o Opcodes) SETOC(ops ...Operand) { o.a.op("SETOC", ops...) } func (o Opcodes) Setos(ops ...Operand) { o.a.op("SETOS", ops...) } func (o Opcodes) SETOS(ops ...Operand) { o.a.op("SETOS", ops...) } func (o Opcodes) Setpc(ops ...Operand) { o.a.op("SETPC", ops...) } func (o Opcodes) SETPC(ops ...Operand) { o.a.op("SETPC", ops...) } func (o Opcodes) Setpl(ops ...Operand) { o.a.op("SETPL", ops...) } func (o Opcodes) SETPL(ops ...Operand) { o.a.op("SETPL", ops...) } func (o Opcodes) Setps(ops ...Operand) { o.a.op("SETPS", ops...) } func (o Opcodes) SETPS(ops ...Operand) { o.a.op("SETPS", ops...) } func (o Opcodes) Sfence(ops ...Operand) { o.a.op("SFENCE", ops...) } func (o Opcodes) SFENCE(ops ...Operand) { o.a.op("SFENCE", ops...) } func (o Opcodes) Sgdt(ops ...Operand) { o.a.op("SGDT", ops...) } func (o Opcodes) SGDT(ops ...Operand) { o.a.op("SGDT", ops...) } func (o Opcodes) Sha1msg1(ops ...Operand) { o.a.op("SHA1MSG1", ops...) } func (o Opcodes) SHA1MSG1(ops ...Operand) { o.a.op("SHA1MSG1", ops...) } func (o Opcodes) Sha1msg2(ops ...Operand) { o.a.op("SHA1MSG2", ops...) } func (o Opcodes) SHA1MSG2(ops ...Operand) { o.a.op("SHA1MSG2", ops...) } func (o Opcodes) Sha1nexte(ops ...Operand) { o.a.op("SHA1NEXTE", ops...) } func (o Opcodes) SHA1NEXTE(ops ...Operand) { o.a.op("SHA1NEXTE", ops...) } func (o Opcodes) Sha1rnds4(ops ...Operand) { o.a.op("SHA1RNDS4", ops...) } func (o Opcodes) SHA1RNDS4(ops ...Operand) { o.a.op("SHA1RNDS4", ops...) } func (o Opcodes) Sha256msg1(ops ...Operand) { o.a.op("SHA256MSG1", ops...) } func (o Opcodes) SHA256MSG1(ops ...Operand) { o.a.op("SHA256MSG1", ops...) } func (o Opcodes) Sha256msg2(ops ...Operand) { o.a.op("SHA256MSG2", ops...) } func (o Opcodes) SHA256MSG2(ops ...Operand) { o.a.op("SHA256MSG2", ops...) } func (o Opcodes) Sha256rnds2(ops ...Operand) { o.a.op("SHA256RNDS2", ops...) } func (o Opcodes) SHA256RNDS2(ops ...Operand) { o.a.op("SHA256RNDS2", ops...) } func (o Opcodes) Shlb(ops ...Operand) { o.a.op("SHLB", ops...) } func (o Opcodes) SHLB(ops ...Operand) { o.a.op("SHLB", ops...) } func (o Opcodes) Shll(ops ...Operand) { o.a.op("SHLL", ops...) } func (o Opcodes) SHLL(ops ...Operand) { o.a.op("SHLL", ops...) } func (o Opcodes) Shlq(ops ...Operand) { o.a.op("SHLQ", ops...) } func (o Opcodes) SHLQ(ops ...Operand) { o.a.op("SHLQ", ops...) } func (o Opcodes) Shlw(ops ...Operand) { o.a.op("SHLW", ops...) } func (o Opcodes) SHLW(ops ...Operand) { o.a.op("SHLW", ops...) } func (o Opcodes) Shlxl(ops ...Operand) { o.a.op("SHLXL", ops...) } func (o Opcodes) SHLXL(ops ...Operand) { o.a.op("SHLXL", ops...) } func (o Opcodes) Shlxq(ops ...Operand) { o.a.op("SHLXQ", ops...) } func (o Opcodes) SHLXQ(ops ...Operand) { o.a.op("SHLXQ", ops...) } func (o Opcodes) Shrb(ops ...Operand) { o.a.op("SHRB", ops...) } func (o Opcodes) SHRB(ops ...Operand) { o.a.op("SHRB", ops...) } func (o Opcodes) Shrl(ops ...Operand) { o.a.op("SHRL", ops...) } func (o Opcodes) SHRL(ops ...Operand) { o.a.op("SHRL", ops...) } func (o Opcodes) Shrq(ops ...Operand) { o.a.op("SHRQ", ops...) } func (o Opcodes) SHRQ(ops ...Operand) { o.a.op("SHRQ", ops...) } func (o Opcodes) Shrw(ops ...Operand) { o.a.op("SHRW", ops...) } func (o Opcodes) SHRW(ops ...Operand) { o.a.op("SHRW", ops...) } func (o Opcodes) Shrxl(ops ...Operand) { o.a.op("SHRXL", ops...) } func (o Opcodes) SHRXL(ops ...Operand) { o.a.op("SHRXL", ops...) } func (o Opcodes) Shrxq(ops ...Operand) { o.a.op("SHRXQ", ops...) } func (o Opcodes) SHRXQ(ops ...Operand) { o.a.op("SHRXQ", ops...) } func (o Opcodes) Shufpd(ops ...Operand) { o.a.op("SHUFPD", ops...) } func (o Opcodes) SHUFPD(ops ...Operand) { o.a.op("SHUFPD", ops...) } func (o Opcodes) Shufps(ops ...Operand) { o.a.op("SHUFPS", ops...) } func (o Opcodes) SHUFPS(ops ...Operand) { o.a.op("SHUFPS", ops...) } func (o Opcodes) Sidt(ops ...Operand) { o.a.op("SIDT", ops...) } func (o Opcodes) SIDT(ops ...Operand) { o.a.op("SIDT", ops...) } func (o Opcodes) Sldtl(ops ...Operand) { o.a.op("SLDTL", ops...) } func (o Opcodes) SLDTL(ops ...Operand) { o.a.op("SLDTL", ops...) } func (o Opcodes) Sldtq(ops ...Operand) { o.a.op("SLDTQ", ops...) } func (o Opcodes) SLDTQ(ops ...Operand) { o.a.op("SLDTQ", ops...) } func (o Opcodes) Sldtw(ops ...Operand) { o.a.op("SLDTW", ops...) } func (o Opcodes) SLDTW(ops ...Operand) { o.a.op("SLDTW", ops...) } func (o Opcodes) Smswl(ops ...Operand) { o.a.op("SMSWL", ops...) } func (o Opcodes) SMSWL(ops ...Operand) { o.a.op("SMSWL", ops...) } func (o Opcodes) Smswq(ops ...Operand) { o.a.op("SMSWQ", ops...) } func (o Opcodes) SMSWQ(ops ...Operand) { o.a.op("SMSWQ", ops...) } func (o Opcodes) Smsww(ops ...Operand) { o.a.op("SMSWW", ops...) } func (o Opcodes) SMSWW(ops ...Operand) { o.a.op("SMSWW", ops...) } func (o Opcodes) Sqrtpd(ops ...Operand) { o.a.op("SQRTPD", ops...) } func (o Opcodes) SQRTPD(ops ...Operand) { o.a.op("SQRTPD", ops...) } func (o Opcodes) Sqrtps(ops ...Operand) { o.a.op("SQRTPS", ops...) } func (o Opcodes) SQRTPS(ops ...Operand) { o.a.op("SQRTPS", ops...) } func (o Opcodes) Sqrtsd(ops ...Operand) { o.a.op("SQRTSD", ops...) } func (o Opcodes) SQRTSD(ops ...Operand) { o.a.op("SQRTSD", ops...) } func (o Opcodes) Sqrtss(ops ...Operand) { o.a.op("SQRTSS", ops...) } func (o Opcodes) SQRTSS(ops ...Operand) { o.a.op("SQRTSS", ops...) } func (o Opcodes) Stac(ops ...Operand) { o.a.op("STAC", ops...) } func (o Opcodes) STAC(ops ...Operand) { o.a.op("STAC", ops...) } func (o Opcodes) Stc(ops ...Operand) { o.a.op("STC", ops...) } func (o Opcodes) STC(ops ...Operand) { o.a.op("STC", ops...) } func (o Opcodes) Std(ops ...Operand) { o.a.op("STD", ops...) } func (o Opcodes) STD(ops ...Operand) { o.a.op("STD", ops...) } func (o Opcodes) Sti(ops ...Operand) { o.a.op("STI", ops...) } func (o Opcodes) STI(ops ...Operand) { o.a.op("STI", ops...) } func (o Opcodes) Stmxcsr(ops ...Operand) { o.a.op("STMXCSR", ops...) } func (o Opcodes) STMXCSR(ops ...Operand) { o.a.op("STMXCSR", ops...) } func (o Opcodes) Stosb(ops ...Operand) { o.a.op("STOSB", ops...) } func (o Opcodes) STOSB(ops ...Operand) { o.a.op("STOSB", ops...) } func (o Opcodes) Stosl(ops ...Operand) { o.a.op("STOSL", ops...) } func (o Opcodes) STOSL(ops ...Operand) { o.a.op("STOSL", ops...) } func (o Opcodes) Stosq(ops ...Operand) { o.a.op("STOSQ", ops...) } func (o Opcodes) STOSQ(ops ...Operand) { o.a.op("STOSQ", ops...) } func (o Opcodes) Stosw(ops ...Operand) { o.a.op("STOSW", ops...) } func (o Opcodes) STOSW(ops ...Operand) { o.a.op("STOSW", ops...) } func (o Opcodes) Strl(ops ...Operand) { o.a.op("STRL", ops...) } func (o Opcodes) STRL(ops ...Operand) { o.a.op("STRL", ops...) } func (o Opcodes) Strq(ops ...Operand) { o.a.op("STRQ", ops...) } func (o Opcodes) STRQ(ops ...Operand) { o.a.op("STRQ", ops...) } func (o Opcodes) Strw(ops ...Operand) { o.a.op("STRW", ops...) } func (o Opcodes) STRW(ops ...Operand) { o.a.op("STRW", ops...) } func (o Opcodes) Subb(ops ...Operand) { o.a.op("SUBB", ops...) } func (o Opcodes) SUBB(ops ...Operand) { o.a.op("SUBB", ops...) } func (o Opcodes) Subl(ops ...Operand) { o.a.op("SUBL", ops...) } func (o Opcodes) SUBL(ops ...Operand) { o.a.op("SUBL", ops...) } func (o Opcodes) Subpd(ops ...Operand) { o.a.op("SUBPD", ops...) } func (o Opcodes) SUBPD(ops ...Operand) { o.a.op("SUBPD", ops...) } func (o Opcodes) Subps(ops ...Operand) { o.a.op("SUBPS", ops...) } func (o Opcodes) SUBPS(ops ...Operand) { o.a.op("SUBPS", ops...) } func (o Opcodes) Subq(ops ...Operand) { o.a.op("SUBQ", ops...) } func (o Opcodes) SUBQ(ops ...Operand) { o.a.op("SUBQ", ops...) } func (o Opcodes) Subsd(ops ...Operand) { o.a.op("SUBSD", ops...) } func (o Opcodes) SUBSD(ops ...Operand) { o.a.op("SUBSD", ops...) } func (o Opcodes) Subss(ops ...Operand) { o.a.op("SUBSS", ops...) } func (o Opcodes) SUBSS(ops ...Operand) { o.a.op("SUBSS", ops...) } func (o Opcodes) Subw(ops ...Operand) { o.a.op("SUBW", ops...) } func (o Opcodes) SUBW(ops ...Operand) { o.a.op("SUBW", ops...) } func (o Opcodes) Swapgs(ops ...Operand) { o.a.op("SWAPGS", ops...) } func (o Opcodes) SWAPGS(ops ...Operand) { o.a.op("SWAPGS", ops...) } func (o Opcodes) Syscall(ops ...Operand) { o.a.op("SYSCALL", ops...) } func (o Opcodes) SYSCALL(ops ...Operand) { o.a.op("SYSCALL", ops...) } func (o Opcodes) Sysenter(ops ...Operand) { o.a.op("SYSENTER", ops...) } func (o Opcodes) SYSENTER(ops ...Operand) { o.a.op("SYSENTER", ops...) } func (o Opcodes) Sysenter64(ops ...Operand) { o.a.op("SYSENTER64", ops...) } func (o Opcodes) SYSENTER64(ops ...Operand) { o.a.op("SYSENTER64", ops...) } func (o Opcodes) Sysexit(ops ...Operand) { o.a.op("SYSEXIT", ops...) } func (o Opcodes) SYSEXIT(ops ...Operand) { o.a.op("SYSEXIT", ops...) } func (o Opcodes) Sysexit64(ops ...Operand) { o.a.op("SYSEXIT64", ops...) } func (o Opcodes) SYSEXIT64(ops ...Operand) { o.a.op("SYSEXIT64", ops...) } func (o Opcodes) Sysret(ops ...Operand) { o.a.op("SYSRET", ops...) } func (o Opcodes) SYSRET(ops ...Operand) { o.a.op("SYSRET", ops...) } func (o Opcodes) Testb(ops ...Operand) { o.a.op("TESTB", ops...) } func (o Opcodes) TESTB(ops ...Operand) { o.a.op("TESTB", ops...) } func (o Opcodes) Testl(ops ...Operand) { o.a.op("TESTL", ops...) } func (o Opcodes) TESTL(ops ...Operand) { o.a.op("TESTL", ops...) } func (o Opcodes) Testq(ops ...Operand) { o.a.op("TESTQ", ops...) } func (o Opcodes) TESTQ(ops ...Operand) { o.a.op("TESTQ", ops...) } func (o Opcodes) Testw(ops ...Operand) { o.a.op("TESTW", ops...) } func (o Opcodes) TESTW(ops ...Operand) { o.a.op("TESTW", ops...) } func (o Opcodes) Tzcntl(ops ...Operand) { o.a.op("TZCNTL", ops...) } func (o Opcodes) TZCNTL(ops ...Operand) { o.a.op("TZCNTL", ops...) } func (o Opcodes) Tzcntq(ops ...Operand) { o.a.op("TZCNTQ", ops...) } func (o Opcodes) TZCNTQ(ops ...Operand) { o.a.op("TZCNTQ", ops...) } func (o Opcodes) Tzcntw(ops ...Operand) { o.a.op("TZCNTW", ops...) } func (o Opcodes) TZCNTW(ops ...Operand) { o.a.op("TZCNTW", ops...) } func (o Opcodes) Ucomisd(ops ...Operand) { o.a.op("UCOMISD", ops...) } func (o Opcodes) UCOMISD(ops ...Operand) { o.a.op("UCOMISD", ops...) } func (o Opcodes) Ucomiss(ops ...Operand) { o.a.op("UCOMISS", ops...) } func (o Opcodes) UCOMISS(ops ...Operand) { o.a.op("UCOMISS", ops...) } func (o Opcodes) Ud1(ops ...Operand) { o.a.op("UD1", ops...) } func (o Opcodes) UD1(ops ...Operand) { o.a.op("UD1", ops...) } func (o Opcodes) Ud2(ops ...Operand) { o.a.op("UD2", ops...) } func (o Opcodes) UD2(ops ...Operand) { o.a.op("UD2", ops...) } func (o Opcodes) Unpckhpd(ops ...Operand) { o.a.op("UNPCKHPD", ops...) } func (o Opcodes) UNPCKHPD(ops ...Operand) { o.a.op("UNPCKHPD", ops...) } func (o Opcodes) Unpckhps(ops ...Operand) { o.a.op("UNPCKHPS", ops...) } func (o Opcodes) UNPCKHPS(ops ...Operand) { o.a.op("UNPCKHPS", ops...) } func (o Opcodes) Unpcklpd(ops ...Operand) { o.a.op("UNPCKLPD", ops...) } func (o Opcodes) UNPCKLPD(ops ...Operand) { o.a.op("UNPCKLPD", ops...) } func (o Opcodes) Unpcklps(ops ...Operand) { o.a.op("UNPCKLPS", ops...) } func (o Opcodes) UNPCKLPS(ops ...Operand) { o.a.op("UNPCKLPS", ops...) } func (o Opcodes) V4fmaddps(ops ...Operand) { o.a.op("V4FMADDPS", ops...) } func (o Opcodes) V4FMADDPS(ops ...Operand) { o.a.op("V4FMADDPS", ops...) } func (o Opcodes) V4fmaddss(ops ...Operand) { o.a.op("V4FMADDSS", ops...) } func (o Opcodes) V4FMADDSS(ops ...Operand) { o.a.op("V4FMADDSS", ops...) } func (o Opcodes) V4fnmaddps(ops ...Operand) { o.a.op("V4FNMADDPS", ops...) } func (o Opcodes) V4FNMADDPS(ops ...Operand) { o.a.op("V4FNMADDPS", ops...) } func (o Opcodes) V4fnmaddss(ops ...Operand) { o.a.op("V4FNMADDSS", ops...) } func (o Opcodes) V4FNMADDSS(ops ...Operand) { o.a.op("V4FNMADDSS", ops...) } func (o Opcodes) Vaddpd(ops ...Operand) { o.a.op("VADDPD", ops...) } func (o Opcodes) VADDPD(ops ...Operand) { o.a.op("VADDPD", ops...) } func (o Opcodes) Vaddps(ops ...Operand) { o.a.op("VADDPS", ops...) } func (o Opcodes) VADDPS(ops ...Operand) { o.a.op("VADDPS", ops...) } func (o Opcodes) Vaddsd(ops ...Operand) { o.a.op("VADDSD", ops...) } func (o Opcodes) VADDSD(ops ...Operand) { o.a.op("VADDSD", ops...) } func (o Opcodes) Vaddss(ops ...Operand) { o.a.op("VADDSS", ops...) } func (o Opcodes) VADDSS(ops ...Operand) { o.a.op("VADDSS", ops...) } func (o Opcodes) Vaddsubpd(ops ...Operand) { o.a.op("VADDSUBPD", ops...) } func (o Opcodes) VADDSUBPD(ops ...Operand) { o.a.op("VADDSUBPD", ops...) } func (o Opcodes) Vaddsubps(ops ...Operand) { o.a.op("VADDSUBPS", ops...) } func (o Opcodes) VADDSUBPS(ops ...Operand) { o.a.op("VADDSUBPS", ops...) } func (o Opcodes) Vaesdec(ops ...Operand) { o.a.op("VAESDEC", ops...) } func (o Opcodes) VAESDEC(ops ...Operand) { o.a.op("VAESDEC", ops...) } func (o Opcodes) Vaesdeclast(ops ...Operand) { o.a.op("VAESDECLAST", ops...) } func (o Opcodes) VAESDECLAST(ops ...Operand) { o.a.op("VAESDECLAST", ops...) } func (o Opcodes) Vaesenc(ops ...Operand) { o.a.op("VAESENC", ops...) } func (o Opcodes) VAESENC(ops ...Operand) { o.a.op("VAESENC", ops...) } func (o Opcodes) Vaesenclast(ops ...Operand) { o.a.op("VAESENCLAST", ops...) } func (o Opcodes) VAESENCLAST(ops ...Operand) { o.a.op("VAESENCLAST", ops...) } func (o Opcodes) Vaesimc(ops ...Operand) { o.a.op("VAESIMC", ops...) } func (o Opcodes) VAESIMC(ops ...Operand) { o.a.op("VAESIMC", ops...) } func (o Opcodes) Vaeskeygenassist(ops ...Operand) { o.a.op("VAESKEYGENASSIST", ops...) } func (o Opcodes) VAESKEYGENASSIST(ops ...Operand) { o.a.op("VAESKEYGENASSIST", ops...) } func (o Opcodes) Valignd(ops ...Operand) { o.a.op("VALIGND", ops...) } func (o Opcodes) VALIGND(ops ...Operand) { o.a.op("VALIGND", ops...) } func (o Opcodes) Valignq(ops ...Operand) { o.a.op("VALIGNQ", ops...) } func (o Opcodes) VALIGNQ(ops ...Operand) { o.a.op("VALIGNQ", ops...) } func (o Opcodes) Vandnpd(ops ...Operand) { o.a.op("VANDNPD", ops...) } func (o Opcodes) VANDNPD(ops ...Operand) { o.a.op("VANDNPD", ops...) } func (o Opcodes) Vandnps(ops ...Operand) { o.a.op("VANDNPS", ops...) } func (o Opcodes) VANDNPS(ops ...Operand) { o.a.op("VANDNPS", ops...) } func (o Opcodes) Vandpd(ops ...Operand) { o.a.op("VANDPD", ops...) } func (o Opcodes) VANDPD(ops ...Operand) { o.a.op("VANDPD", ops...) } func (o Opcodes) Vandps(ops ...Operand) { o.a.op("VANDPS", ops...) } func (o Opcodes) VANDPS(ops ...Operand) { o.a.op("VANDPS", ops...) } func (o Opcodes) Vblendmpd(ops ...Operand) { o.a.op("VBLENDMPD", ops...) } func (o Opcodes) VBLENDMPD(ops ...Operand) { o.a.op("VBLENDMPD", ops...) } func (o Opcodes) Vblendmps(ops ...Operand) { o.a.op("VBLENDMPS", ops...) } func (o Opcodes) VBLENDMPS(ops ...Operand) { o.a.op("VBLENDMPS", ops...) } func (o Opcodes) Vblendpd(ops ...Operand) { o.a.op("VBLENDPD", ops...) } func (o Opcodes) VBLENDPD(ops ...Operand) { o.a.op("VBLENDPD", ops...) } func (o Opcodes) Vblendps(ops ...Operand) { o.a.op("VBLENDPS", ops...) } func (o Opcodes) VBLENDPS(ops ...Operand) { o.a.op("VBLENDPS", ops...) } func (o Opcodes) Vblendvpd(ops ...Operand) { o.a.op("VBLENDVPD", ops...) } func (o Opcodes) VBLENDVPD(ops ...Operand) { o.a.op("VBLENDVPD", ops...) } func (o Opcodes) Vblendvps(ops ...Operand) { o.a.op("VBLENDVPS", ops...) } func (o Opcodes) VBLENDVPS(ops ...Operand) { o.a.op("VBLENDVPS", ops...) } func (o Opcodes) Vbroadcastf128(ops ...Operand) { o.a.op("VBROADCASTF128", ops...) } func (o Opcodes) VBROADCASTF128(ops ...Operand) { o.a.op("VBROADCASTF128", ops...) } func (o Opcodes) Vbroadcastf32x2(ops ...Operand) { o.a.op("VBROADCASTF32X2", ops...) } func (o Opcodes) VBROADCASTF32X2(ops ...Operand) { o.a.op("VBROADCASTF32X2", ops...) } func (o Opcodes) Vbroadcastf32x4(ops ...Operand) { o.a.op("VBROADCASTF32X4", ops...) } func (o Opcodes) VBROADCASTF32X4(ops ...Operand) { o.a.op("VBROADCASTF32X4", ops...) } func (o Opcodes) Vbroadcastf32x8(ops ...Operand) { o.a.op("VBROADCASTF32X8", ops...) } func (o Opcodes) VBROADCASTF32X8(ops ...Operand) { o.a.op("VBROADCASTF32X8", ops...) } func (o Opcodes) Vbroadcastf64x2(ops ...Operand) { o.a.op("VBROADCASTF64X2", ops...) } func (o Opcodes) VBROADCASTF64X2(ops ...Operand) { o.a.op("VBROADCASTF64X2", ops...) } func (o Opcodes) Vbroadcastf64x4(ops ...Operand) { o.a.op("VBROADCASTF64X4", ops...) } func (o Opcodes) VBROADCASTF64X4(ops ...Operand) { o.a.op("VBROADCASTF64X4", ops...) } func (o Opcodes) Vbroadcasti128(ops ...Operand) { o.a.op("VBROADCASTI128", ops...) } func (o Opcodes) VBROADCASTI128(ops ...Operand) { o.a.op("VBROADCASTI128", ops...) } func (o Opcodes) Vbroadcasti32x2(ops ...Operand) { o.a.op("VBROADCASTI32X2", ops...) } func (o Opcodes) VBROADCASTI32X2(ops ...Operand) { o.a.op("VBROADCASTI32X2", ops...) } func (o Opcodes) Vbroadcasti32x4(ops ...Operand) { o.a.op("VBROADCASTI32X4", ops...) } func (o Opcodes) VBROADCASTI32X4(ops ...Operand) { o.a.op("VBROADCASTI32X4", ops...) } func (o Opcodes) Vbroadcasti32x8(ops ...Operand) { o.a.op("VBROADCASTI32X8", ops...) } func (o Opcodes) VBROADCASTI32X8(ops ...Operand) { o.a.op("VBROADCASTI32X8", ops...) } func (o Opcodes) Vbroadcasti64x2(ops ...Operand) { o.a.op("VBROADCASTI64X2", ops...) } func (o Opcodes) VBROADCASTI64X2(ops ...Operand) { o.a.op("VBROADCASTI64X2", ops...) } func (o Opcodes) Vbroadcasti64x4(ops ...Operand) { o.a.op("VBROADCASTI64X4", ops...) } func (o Opcodes) VBROADCASTI64X4(ops ...Operand) { o.a.op("VBROADCASTI64X4", ops...) } func (o Opcodes) Vbroadcastsd(ops ...Operand) { o.a.op("VBROADCASTSD", ops...) } func (o Opcodes) VBROADCASTSD(ops ...Operand) { o.a.op("VBROADCASTSD", ops...) } func (o Opcodes) Vbroadcastss(ops ...Operand) { o.a.op("VBROADCASTSS", ops...) } func (o Opcodes) VBROADCASTSS(ops ...Operand) { o.a.op("VBROADCASTSS", ops...) } func (o Opcodes) Vcmppd(ops ...Operand) { o.a.op("VCMPPD", ops...) } func (o Opcodes) VCMPPD(ops ...Operand) { o.a.op("VCMPPD", ops...) } func (o Opcodes) Vcmpps(ops ...Operand) { o.a.op("VCMPPS", ops...) } func (o Opcodes) VCMPPS(ops ...Operand) { o.a.op("VCMPPS", ops...) } func (o Opcodes) Vcmpsd(ops ...Operand) { o.a.op("VCMPSD", ops...) } func (o Opcodes) VCMPSD(ops ...Operand) { o.a.op("VCMPSD", ops...) } func (o Opcodes) Vcmpss(ops ...Operand) { o.a.op("VCMPSS", ops...) } func (o Opcodes) VCMPSS(ops ...Operand) { o.a.op("VCMPSS", ops...) } func (o Opcodes) Vcomisd(ops ...Operand) { o.a.op("VCOMISD", ops...) } func (o Opcodes) VCOMISD(ops ...Operand) { o.a.op("VCOMISD", ops...) } func (o Opcodes) Vcomiss(ops ...Operand) { o.a.op("VCOMISS", ops...) } func (o Opcodes) VCOMISS(ops ...Operand) { o.a.op("VCOMISS", ops...) } func (o Opcodes) Vcompresspd(ops ...Operand) { o.a.op("VCOMPRESSPD", ops...) } func (o Opcodes) VCOMPRESSPD(ops ...Operand) { o.a.op("VCOMPRESSPD", ops...) } func (o Opcodes) Vcompressps(ops ...Operand) { o.a.op("VCOMPRESSPS", ops...) } func (o Opcodes) VCOMPRESSPS(ops ...Operand) { o.a.op("VCOMPRESSPS", ops...) } func (o Opcodes) Vcvtdq2pd(ops ...Operand) { o.a.op("VCVTDQ2PD", ops...) } func (o Opcodes) VCVTDQ2PD(ops ...Operand) { o.a.op("VCVTDQ2PD", ops...) } func (o Opcodes) Vcvtdq2ps(ops ...Operand) { o.a.op("VCVTDQ2PS", ops...) } func (o Opcodes) VCVTDQ2PS(ops ...Operand) { o.a.op("VCVTDQ2PS", ops...) } func (o Opcodes) Vcvtpd2dq(ops ...Operand) { o.a.op("VCVTPD2DQ", ops...) } func (o Opcodes) VCVTPD2DQ(ops ...Operand) { o.a.op("VCVTPD2DQ", ops...) } func (o Opcodes) Vcvtpd2dqx(ops ...Operand) { o.a.op("VCVTPD2DQX", ops...) } func (o Opcodes) VCVTPD2DQX(ops ...Operand) { o.a.op("VCVTPD2DQX", ops...) } func (o Opcodes) Vcvtpd2dqy(ops ...Operand) { o.a.op("VCVTPD2DQY", ops...) } func (o Opcodes) VCVTPD2DQY(ops ...Operand) { o.a.op("VCVTPD2DQY", ops...) } func (o Opcodes) Vcvtpd2ps(ops ...Operand) { o.a.op("VCVTPD2PS", ops...) } func (o Opcodes) VCVTPD2PS(ops ...Operand) { o.a.op("VCVTPD2PS", ops...) } func (o Opcodes) Vcvtpd2psx(ops ...Operand) { o.a.op("VCVTPD2PSX", ops...) } func (o Opcodes) VCVTPD2PSX(ops ...Operand) { o.a.op("VCVTPD2PSX", ops...) } func (o Opcodes) Vcvtpd2psy(ops ...Operand) { o.a.op("VCVTPD2PSY", ops...) } func (o Opcodes) VCVTPD2PSY(ops ...Operand) { o.a.op("VCVTPD2PSY", ops...) } func (o Opcodes) Vcvtpd2qq(ops ...Operand) { o.a.op("VCVTPD2QQ", ops...) } func (o Opcodes) VCVTPD2QQ(ops ...Operand) { o.a.op("VCVTPD2QQ", ops...) } func (o Opcodes) Vcvtpd2udq(ops ...Operand) { o.a.op("VCVTPD2UDQ", ops...) } func (o Opcodes) VCVTPD2UDQ(ops ...Operand) { o.a.op("VCVTPD2UDQ", ops...) } func (o Opcodes) Vcvtpd2udqx(ops ...Operand) { o.a.op("VCVTPD2UDQX", ops...) } func (o Opcodes) VCVTPD2UDQX(ops ...Operand) { o.a.op("VCVTPD2UDQX", ops...) } func (o Opcodes) Vcvtpd2udqy(ops ...Operand) { o.a.op("VCVTPD2UDQY", ops...) } func (o Opcodes) VCVTPD2UDQY(ops ...Operand) { o.a.op("VCVTPD2UDQY", ops...) } func (o Opcodes) Vcvtpd2uqq(ops ...Operand) { o.a.op("VCVTPD2UQQ", ops...) } func (o Opcodes) VCVTPD2UQQ(ops ...Operand) { o.a.op("VCVTPD2UQQ", ops...) } func (o Opcodes) Vcvtph2ps(ops ...Operand) { o.a.op("VCVTPH2PS", ops...) } func (o Opcodes) VCVTPH2PS(ops ...Operand) { o.a.op("VCVTPH2PS", ops...) } func (o Opcodes) Vcvtps2dq(ops ...Operand) { o.a.op("VCVTPS2DQ", ops...) } func (o Opcodes) VCVTPS2DQ(ops ...Operand) { o.a.op("VCVTPS2DQ", ops...) } func (o Opcodes) Vcvtps2pd(ops ...Operand) { o.a.op("VCVTPS2PD", ops...) } func (o Opcodes) VCVTPS2PD(ops ...Operand) { o.a.op("VCVTPS2PD", ops...) } func (o Opcodes) Vcvtps2ph(ops ...Operand) { o.a.op("VCVTPS2PH", ops...) } func (o Opcodes) VCVTPS2PH(ops ...Operand) { o.a.op("VCVTPS2PH", ops...) } func (o Opcodes) Vcvtps2qq(ops ...Operand) { o.a.op("VCVTPS2QQ", ops...) } func (o Opcodes) VCVTPS2QQ(ops ...Operand) { o.a.op("VCVTPS2QQ", ops...) } func (o Opcodes) Vcvtps2udq(ops ...Operand) { o.a.op("VCVTPS2UDQ", ops...) } func (o Opcodes) VCVTPS2UDQ(ops ...Operand) { o.a.op("VCVTPS2UDQ", ops...) } func (o Opcodes) Vcvtps2uqq(ops ...Operand) { o.a.op("VCVTPS2UQQ", ops...) } func (o Opcodes) VCVTPS2UQQ(ops ...Operand) { o.a.op("VCVTPS2UQQ", ops...) } func (o Opcodes) Vcvtqq2pd(ops ...Operand) { o.a.op("VCVTQQ2PD", ops...) } func (o Opcodes) VCVTQQ2PD(ops ...Operand) { o.a.op("VCVTQQ2PD", ops...) } func (o Opcodes) Vcvtqq2ps(ops ...Operand) { o.a.op("VCVTQQ2PS", ops...) } func (o Opcodes) VCVTQQ2PS(ops ...Operand) { o.a.op("VCVTQQ2PS", ops...) } func (o Opcodes) Vcvtqq2psx(ops ...Operand) { o.a.op("VCVTQQ2PSX", ops...) } func (o Opcodes) VCVTQQ2PSX(ops ...Operand) { o.a.op("VCVTQQ2PSX", ops...) } func (o Opcodes) Vcvtqq2psy(ops ...Operand) { o.a.op("VCVTQQ2PSY", ops...) } func (o Opcodes) VCVTQQ2PSY(ops ...Operand) { o.a.op("VCVTQQ2PSY", ops...) } func (o Opcodes) Vcvtsd2si(ops ...Operand) { o.a.op("VCVTSD2SI", ops...) } func (o Opcodes) VCVTSD2SI(ops ...Operand) { o.a.op("VCVTSD2SI", ops...) } func (o Opcodes) Vcvtsd2siq(ops ...Operand) { o.a.op("VCVTSD2SIQ", ops...) } func (o Opcodes) VCVTSD2SIQ(ops ...Operand) { o.a.op("VCVTSD2SIQ", ops...) } func (o Opcodes) Vcvtsd2ss(ops ...Operand) { o.a.op("VCVTSD2SS", ops...) } func (o Opcodes) VCVTSD2SS(ops ...Operand) { o.a.op("VCVTSD2SS", ops...) } func (o Opcodes) Vcvtsd2usi(ops ...Operand) { o.a.op("VCVTSD2USI", ops...) } func (o Opcodes) VCVTSD2USI(ops ...Operand) { o.a.op("VCVTSD2USI", ops...) } func (o Opcodes) Vcvtsd2usil(ops ...Operand) { o.a.op("VCVTSD2USIL", ops...) } func (o Opcodes) VCVTSD2USIL(ops ...Operand) { o.a.op("VCVTSD2USIL", ops...) } func (o Opcodes) Vcvtsd2usiq(ops ...Operand) { o.a.op("VCVTSD2USIQ", ops...) } func (o Opcodes) VCVTSD2USIQ(ops ...Operand) { o.a.op("VCVTSD2USIQ", ops...) } func (o Opcodes) Vcvtsi2sdl(ops ...Operand) { o.a.op("VCVTSI2SDL", ops...) } func (o Opcodes) VCVTSI2SDL(ops ...Operand) { o.a.op("VCVTSI2SDL", ops...) } func (o Opcodes) Vcvtsi2sdq(ops ...Operand) { o.a.op("VCVTSI2SDQ", ops...) } func (o Opcodes) VCVTSI2SDQ(ops ...Operand) { o.a.op("VCVTSI2SDQ", ops...) } func (o Opcodes) Vcvtsi2ssl(ops ...Operand) { o.a.op("VCVTSI2SSL", ops...) } func (o Opcodes) VCVTSI2SSL(ops ...Operand) { o.a.op("VCVTSI2SSL", ops...) } func (o Opcodes) Vcvtsi2ssq(ops ...Operand) { o.a.op("VCVTSI2SSQ", ops...) } func (o Opcodes) VCVTSI2SSQ(ops ...Operand) { o.a.op("VCVTSI2SSQ", ops...) } func (o Opcodes) Vcvtss2sd(ops ...Operand) { o.a.op("VCVTSS2SD", ops...) } func (o Opcodes) VCVTSS2SD(ops ...Operand) { o.a.op("VCVTSS2SD", ops...) } func (o Opcodes) Vcvtss2si(ops ...Operand) { o.a.op("VCVTSS2SI", ops...) } func (o Opcodes) VCVTSS2SI(ops ...Operand) { o.a.op("VCVTSS2SI", ops...) } func (o Opcodes) Vcvtss2siq(ops ...Operand) { o.a.op("VCVTSS2SIQ", ops...) } func (o Opcodes) VCVTSS2SIQ(ops ...Operand) { o.a.op("VCVTSS2SIQ", ops...) } func (o Opcodes) Vcvtss2usi(ops ...Operand) { o.a.op("VCVTSS2USI", ops...) } func (o Opcodes) VCVTSS2USI(ops ...Operand) { o.a.op("VCVTSS2USI", ops...) } func (o Opcodes) Vcvtss2usil(ops ...Operand) { o.a.op("VCVTSS2USIL", ops...) } func (o Opcodes) VCVTSS2USIL(ops ...Operand) { o.a.op("VCVTSS2USIL", ops...) } func (o Opcodes) Vcvtss2usiq(ops ...Operand) { o.a.op("VCVTSS2USIQ", ops...) } func (o Opcodes) VCVTSS2USIQ(ops ...Operand) { o.a.op("VCVTSS2USIQ", ops...) } func (o Opcodes) Vcvttpd2dq(ops ...Operand) { o.a.op("VCVTTPD2DQ", ops...) } func (o Opcodes) VCVTTPD2DQ(ops ...Operand) { o.a.op("VCVTTPD2DQ", ops...) } func (o Opcodes) Vcvttpd2dqx(ops ...Operand) { o.a.op("VCVTTPD2DQX", ops...) } func (o Opcodes) VCVTTPD2DQX(ops ...Operand) { o.a.op("VCVTTPD2DQX", ops...) } func (o Opcodes) Vcvttpd2dqy(ops ...Operand) { o.a.op("VCVTTPD2DQY", ops...) } func (o Opcodes) VCVTTPD2DQY(ops ...Operand) { o.a.op("VCVTTPD2DQY", ops...) } func (o Opcodes) Vcvttpd2qq(ops ...Operand) { o.a.op("VCVTTPD2QQ", ops...) } func (o Opcodes) VCVTTPD2QQ(ops ...Operand) { o.a.op("VCVTTPD2QQ", ops...) } func (o Opcodes) Vcvttpd2udq(ops ...Operand) { o.a.op("VCVTTPD2UDQ", ops...) } func (o Opcodes) VCVTTPD2UDQ(ops ...Operand) { o.a.op("VCVTTPD2UDQ", ops...) } func (o Opcodes) Vcvttpd2udqx(ops ...Operand) { o.a.op("VCVTTPD2UDQX", ops...) } func (o Opcodes) VCVTTPD2UDQX(ops ...Operand) { o.a.op("VCVTTPD2UDQX", ops...) } func (o Opcodes) Vcvttpd2udqy(ops ...Operand) { o.a.op("VCVTTPD2UDQY", ops...) } func (o Opcodes) VCVTTPD2UDQY(ops ...Operand) { o.a.op("VCVTTPD2UDQY", ops...) } func (o Opcodes) Vcvttpd2uqq(ops ...Operand) { o.a.op("VCVTTPD2UQQ", ops...) } func (o Opcodes) VCVTTPD2UQQ(ops ...Operand) { o.a.op("VCVTTPD2UQQ", ops...) } func (o Opcodes) Vcvttps2dq(ops ...Operand) { o.a.op("VCVTTPS2DQ", ops...) } func (o Opcodes) VCVTTPS2DQ(ops ...Operand) { o.a.op("VCVTTPS2DQ", ops...) } func (o Opcodes) Vcvttps2qq(ops ...Operand) { o.a.op("VCVTTPS2QQ", ops...) } func (o Opcodes) VCVTTPS2QQ(ops ...Operand) { o.a.op("VCVTTPS2QQ", ops...) } func (o Opcodes) Vcvttps2udq(ops ...Operand) { o.a.op("VCVTTPS2UDQ", ops...) } func (o Opcodes) VCVTTPS2UDQ(ops ...Operand) { o.a.op("VCVTTPS2UDQ", ops...) } func (o Opcodes) Vcvttps2uqq(ops ...Operand) { o.a.op("VCVTTPS2UQQ", ops...) } func (o Opcodes) VCVTTPS2UQQ(ops ...Operand) { o.a.op("VCVTTPS2UQQ", ops...) } func (o Opcodes) Vcvttsd2si(ops ...Operand) { o.a.op("VCVTTSD2SI", ops...) } func (o Opcodes) VCVTTSD2SI(ops ...Operand) { o.a.op("VCVTTSD2SI", ops...) } func (o Opcodes) Vcvttsd2siq(ops ...Operand) { o.a.op("VCVTTSD2SIQ", ops...) } func (o Opcodes) VCVTTSD2SIQ(ops ...Operand) { o.a.op("VCVTTSD2SIQ", ops...) } func (o Opcodes) Vcvttsd2usi(ops ...Operand) { o.a.op("VCVTTSD2USI", ops...) } func (o Opcodes) VCVTTSD2USI(ops ...Operand) { o.a.op("VCVTTSD2USI", ops...) } func (o Opcodes) Vcvttsd2usil(ops ...Operand) { o.a.op("VCVTTSD2USIL", ops...) } func (o Opcodes) VCVTTSD2USIL(ops ...Operand) { o.a.op("VCVTTSD2USIL", ops...) } func (o Opcodes) Vcvttsd2usiq(ops ...Operand) { o.a.op("VCVTTSD2USIQ", ops...) } func (o Opcodes) VCVTTSD2USIQ(ops ...Operand) { o.a.op("VCVTTSD2USIQ", ops...) } func (o Opcodes) Vcvttss2si(ops ...Operand) { o.a.op("VCVTTSS2SI", ops...) } func (o Opcodes) VCVTTSS2SI(ops ...Operand) { o.a.op("VCVTTSS2SI", ops...) } func (o Opcodes) Vcvttss2siq(ops ...Operand) { o.a.op("VCVTTSS2SIQ", ops...) } func (o Opcodes) VCVTTSS2SIQ(ops ...Operand) { o.a.op("VCVTTSS2SIQ", ops...) } func (o Opcodes) Vcvttss2usi(ops ...Operand) { o.a.op("VCVTTSS2USI", ops...) } func (o Opcodes) VCVTTSS2USI(ops ...Operand) { o.a.op("VCVTTSS2USI", ops...) } func (o Opcodes) Vcvttss2usil(ops ...Operand) { o.a.op("VCVTTSS2USIL", ops...) } func (o Opcodes) VCVTTSS2USIL(ops ...Operand) { o.a.op("VCVTTSS2USIL", ops...) } func (o Opcodes) Vcvttss2usiq(ops ...Operand) { o.a.op("VCVTTSS2USIQ", ops...) } func (o Opcodes) VCVTTSS2USIQ(ops ...Operand) { o.a.op("VCVTTSS2USIQ", ops...) } func (o Opcodes) Vcvtudq2pd(ops ...Operand) { o.a.op("VCVTUDQ2PD", ops...) } func (o Opcodes) VCVTUDQ2PD(ops ...Operand) { o.a.op("VCVTUDQ2PD", ops...) } func (o Opcodes) Vcvtudq2ps(ops ...Operand) { o.a.op("VCVTUDQ2PS", ops...) } func (o Opcodes) VCVTUDQ2PS(ops ...Operand) { o.a.op("VCVTUDQ2PS", ops...) } func (o Opcodes) Vcvtuqq2pd(ops ...Operand) { o.a.op("VCVTUQQ2PD", ops...) } func (o Opcodes) VCVTUQQ2PD(ops ...Operand) { o.a.op("VCVTUQQ2PD", ops...) } func (o Opcodes) Vcvtuqq2ps(ops ...Operand) { o.a.op("VCVTUQQ2PS", ops...) } func (o Opcodes) VCVTUQQ2PS(ops ...Operand) { o.a.op("VCVTUQQ2PS", ops...) } func (o Opcodes) Vcvtuqq2psx(ops ...Operand) { o.a.op("VCVTUQQ2PSX", ops...) } func (o Opcodes) VCVTUQQ2PSX(ops ...Operand) { o.a.op("VCVTUQQ2PSX", ops...) } func (o Opcodes) Vcvtuqq2psy(ops ...Operand) { o.a.op("VCVTUQQ2PSY", ops...) } func (o Opcodes) VCVTUQQ2PSY(ops ...Operand) { o.a.op("VCVTUQQ2PSY", ops...) } func (o Opcodes) Vcvtusi2sd(ops ...Operand) { o.a.op("VCVTUSI2SD", ops...) } func (o Opcodes) VCVTUSI2SD(ops ...Operand) { o.a.op("VCVTUSI2SD", ops...) } func (o Opcodes) Vcvtusi2sdl(ops ...Operand) { o.a.op("VCVTUSI2SDL", ops...) } func (o Opcodes) VCVTUSI2SDL(ops ...Operand) { o.a.op("VCVTUSI2SDL", ops...) } func (o Opcodes) Vcvtusi2sdq(ops ...Operand) { o.a.op("VCVTUSI2SDQ", ops...) } func (o Opcodes) VCVTUSI2SDQ(ops ...Operand) { o.a.op("VCVTUSI2SDQ", ops...) } func (o Opcodes) Vcvtusi2ss(ops ...Operand) { o.a.op("VCVTUSI2SS", ops...) } func (o Opcodes) VCVTUSI2SS(ops ...Operand) { o.a.op("VCVTUSI2SS", ops...) } func (o Opcodes) Vcvtusi2ssl(ops ...Operand) { o.a.op("VCVTUSI2SSL", ops...) } func (o Opcodes) VCVTUSI2SSL(ops ...Operand) { o.a.op("VCVTUSI2SSL", ops...) } func (o Opcodes) Vcvtusi2ssq(ops ...Operand) { o.a.op("VCVTUSI2SSQ", ops...) } func (o Opcodes) VCVTUSI2SSQ(ops ...Operand) { o.a.op("VCVTUSI2SSQ", ops...) } func (o Opcodes) Vdbpsadbw(ops ...Operand) { o.a.op("VDBPSADBW", ops...) } func (o Opcodes) VDBPSADBW(ops ...Operand) { o.a.op("VDBPSADBW", ops...) } func (o Opcodes) Vdivpd(ops ...Operand) { o.a.op("VDIVPD", ops...) } func (o Opcodes) VDIVPD(ops ...Operand) { o.a.op("VDIVPD", ops...) } func (o Opcodes) Vdivps(ops ...Operand) { o.a.op("VDIVPS", ops...) } func (o Opcodes) VDIVPS(ops ...Operand) { o.a.op("VDIVPS", ops...) } func (o Opcodes) Vdivsd(ops ...Operand) { o.a.op("VDIVSD", ops...) } func (o Opcodes) VDIVSD(ops ...Operand) { o.a.op("VDIVSD", ops...) } func (o Opcodes) Vdivss(ops ...Operand) { o.a.op("VDIVSS", ops...) } func (o Opcodes) VDIVSS(ops ...Operand) { o.a.op("VDIVSS", ops...) } func (o Opcodes) Vdppd(ops ...Operand) { o.a.op("VDPPD", ops...) } func (o Opcodes) VDPPD(ops ...Operand) { o.a.op("VDPPD", ops...) } func (o Opcodes) Vdpps(ops ...Operand) { o.a.op("VDPPS", ops...) } func (o Opcodes) VDPPS(ops ...Operand) { o.a.op("VDPPS", ops...) } func (o Opcodes) Verr(ops ...Operand) { o.a.op("VERR", ops...) } func (o Opcodes) VERR(ops ...Operand) { o.a.op("VERR", ops...) } func (o Opcodes) Verw(ops ...Operand) { o.a.op("VERW", ops...) } func (o Opcodes) VERW(ops ...Operand) { o.a.op("VERW", ops...) } func (o Opcodes) Vexp2pd(ops ...Operand) { o.a.op("VEXP2PD", ops...) } func (o Opcodes) VEXP2PD(ops ...Operand) { o.a.op("VEXP2PD", ops...) } func (o Opcodes) Vexp2ps(ops ...Operand) { o.a.op("VEXP2PS", ops...) } func (o Opcodes) VEXP2PS(ops ...Operand) { o.a.op("VEXP2PS", ops...) } func (o Opcodes) Vexpandpd(ops ...Operand) { o.a.op("VEXPANDPD", ops...) } func (o Opcodes) VEXPANDPD(ops ...Operand) { o.a.op("VEXPANDPD", ops...) } func (o Opcodes) Vexpandps(ops ...Operand) { o.a.op("VEXPANDPS", ops...) } func (o Opcodes) VEXPANDPS(ops ...Operand) { o.a.op("VEXPANDPS", ops...) } func (o Opcodes) Vextractf128(ops ...Operand) { o.a.op("VEXTRACTF128", ops...) } func (o Opcodes) VEXTRACTF128(ops ...Operand) { o.a.op("VEXTRACTF128", ops...) } func (o Opcodes) Vextractf32x4(ops ...Operand) { o.a.op("VEXTRACTF32X4", ops...) } func (o Opcodes) VEXTRACTF32X4(ops ...Operand) { o.a.op("VEXTRACTF32X4", ops...) } func (o Opcodes) Vextractf32x8(ops ...Operand) { o.a.op("VEXTRACTF32X8", ops...) } func (o Opcodes) VEXTRACTF32X8(ops ...Operand) { o.a.op("VEXTRACTF32X8", ops...) } func (o Opcodes) Vextractf64x2(ops ...Operand) { o.a.op("VEXTRACTF64X2", ops...) } func (o Opcodes) VEXTRACTF64X2(ops ...Operand) { o.a.op("VEXTRACTF64X2", ops...) } func (o Opcodes) Vextractf64x4(ops ...Operand) { o.a.op("VEXTRACTF64X4", ops...) } func (o Opcodes) VEXTRACTF64X4(ops ...Operand) { o.a.op("VEXTRACTF64X4", ops...) } func (o Opcodes) Vextracti128(ops ...Operand) { o.a.op("VEXTRACTI128", ops...) } func (o Opcodes) VEXTRACTI128(ops ...Operand) { o.a.op("VEXTRACTI128", ops...) } func (o Opcodes) Vextracti32x4(ops ...Operand) { o.a.op("VEXTRACTI32X4", ops...) } func (o Opcodes) VEXTRACTI32X4(ops ...Operand) { o.a.op("VEXTRACTI32X4", ops...) } func (o Opcodes) Vextracti32x8(ops ...Operand) { o.a.op("VEXTRACTI32X8", ops...) } func (o Opcodes) VEXTRACTI32X8(ops ...Operand) { o.a.op("VEXTRACTI32X8", ops...) } func (o Opcodes) Vextracti64x2(ops ...Operand) { o.a.op("VEXTRACTI64X2", ops...) } func (o Opcodes) VEXTRACTI64X2(ops ...Operand) { o.a.op("VEXTRACTI64X2", ops...) } func (o Opcodes) Vextracti64x4(ops ...Operand) { o.a.op("VEXTRACTI64X4", ops...) } func (o Opcodes) VEXTRACTI64X4(ops ...Operand) { o.a.op("VEXTRACTI64X4", ops...) } func (o Opcodes) Vextractps(ops ...Operand) { o.a.op("VEXTRACTPS", ops...) } func (o Opcodes) VEXTRACTPS(ops ...Operand) { o.a.op("VEXTRACTPS", ops...) } func (o Opcodes) Vfixupimmpd(ops ...Operand) { o.a.op("VFIXUPIMMPD", ops...) } func (o Opcodes) VFIXUPIMMPD(ops ...Operand) { o.a.op("VFIXUPIMMPD", ops...) } func (o Opcodes) Vfixupimmps(ops ...Operand) { o.a.op("VFIXUPIMMPS", ops...) } func (o Opcodes) VFIXUPIMMPS(ops ...Operand) { o.a.op("VFIXUPIMMPS", ops...) } func (o Opcodes) Vfixupimmsd(ops ...Operand) { o.a.op("VFIXUPIMMSD", ops...) } func (o Opcodes) VFIXUPIMMSD(ops ...Operand) { o.a.op("VFIXUPIMMSD", ops...) } func (o Opcodes) Vfixupimmss(ops ...Operand) { o.a.op("VFIXUPIMMSS", ops...) } func (o Opcodes) VFIXUPIMMSS(ops ...Operand) { o.a.op("VFIXUPIMMSS", ops...) } func (o Opcodes) Vfmadd132pd(ops ...Operand) { o.a.op("VFMADD132PD", ops...) } func (o Opcodes) VFMADD132PD(ops ...Operand) { o.a.op("VFMADD132PD", ops...) } func (o Opcodes) Vfmadd132ps(ops ...Operand) { o.a.op("VFMADD132PS", ops...) } func (o Opcodes) VFMADD132PS(ops ...Operand) { o.a.op("VFMADD132PS", ops...) } func (o Opcodes) Vfmadd132sd(ops ...Operand) { o.a.op("VFMADD132SD", ops...) } func (o Opcodes) VFMADD132SD(ops ...Operand) { o.a.op("VFMADD132SD", ops...) } func (o Opcodes) Vfmadd132ss(ops ...Operand) { o.a.op("VFMADD132SS", ops...) } func (o Opcodes) VFMADD132SS(ops ...Operand) { o.a.op("VFMADD132SS", ops...) } func (o Opcodes) Vfmadd213pd(ops ...Operand) { o.a.op("VFMADD213PD", ops...) } func (o Opcodes) VFMADD213PD(ops ...Operand) { o.a.op("VFMADD213PD", ops...) } func (o Opcodes) Vfmadd213ps(ops ...Operand) { o.a.op("VFMADD213PS", ops...) } func (o Opcodes) VFMADD213PS(ops ...Operand) { o.a.op("VFMADD213PS", ops...) } func (o Opcodes) Vfmadd213sd(ops ...Operand) { o.a.op("VFMADD213SD", ops...) } func (o Opcodes) VFMADD213SD(ops ...Operand) { o.a.op("VFMADD213SD", ops...) } func (o Opcodes) Vfmadd213ss(ops ...Operand) { o.a.op("VFMADD213SS", ops...) } func (o Opcodes) VFMADD213SS(ops ...Operand) { o.a.op("VFMADD213SS", ops...) } func (o Opcodes) Vfmadd231pd(ops ...Operand) { o.a.op("VFMADD231PD", ops...) } func (o Opcodes) VFMADD231PD(ops ...Operand) { o.a.op("VFMADD231PD", ops...) } func (o Opcodes) Vfmadd231ps(ops ...Operand) { o.a.op("VFMADD231PS", ops...) } func (o Opcodes) VFMADD231PS(ops ...Operand) { o.a.op("VFMADD231PS", ops...) } func (o Opcodes) Vfmadd231sd(ops ...Operand) { o.a.op("VFMADD231SD", ops...) } func (o Opcodes) VFMADD231SD(ops ...Operand) { o.a.op("VFMADD231SD", ops...) } func (o Opcodes) Vfmadd231ss(ops ...Operand) { o.a.op("VFMADD231SS", ops...) } func (o Opcodes) VFMADD231SS(ops ...Operand) { o.a.op("VFMADD231SS", ops...) } func (o Opcodes) Vfmaddsub132pd(ops ...Operand) { o.a.op("VFMADDSUB132PD", ops...) } func (o Opcodes) VFMADDSUB132PD(ops ...Operand) { o.a.op("VFMADDSUB132PD", ops...) } func (o Opcodes) Vfmaddsub132ps(ops ...Operand) { o.a.op("VFMADDSUB132PS", ops...) } func (o Opcodes) VFMADDSUB132PS(ops ...Operand) { o.a.op("VFMADDSUB132PS", ops...) } func (o Opcodes) Vfmaddsub213pd(ops ...Operand) { o.a.op("VFMADDSUB213PD", ops...) } func (o Opcodes) VFMADDSUB213PD(ops ...Operand) { o.a.op("VFMADDSUB213PD", ops...) } func (o Opcodes) Vfmaddsub213ps(ops ...Operand) { o.a.op("VFMADDSUB213PS", ops...) } func (o Opcodes) VFMADDSUB213PS(ops ...Operand) { o.a.op("VFMADDSUB213PS", ops...) } func (o Opcodes) Vfmaddsub231pd(ops ...Operand) { o.a.op("VFMADDSUB231PD", ops...) } func (o Opcodes) VFMADDSUB231PD(ops ...Operand) { o.a.op("VFMADDSUB231PD", ops...) } func (o Opcodes) Vfmaddsub231ps(ops ...Operand) { o.a.op("VFMADDSUB231PS", ops...) } func (o Opcodes) VFMADDSUB231PS(ops ...Operand) { o.a.op("VFMADDSUB231PS", ops...) } func (o Opcodes) Vfmsub132pd(ops ...Operand) { o.a.op("VFMSUB132PD", ops...) } func (o Opcodes) VFMSUB132PD(ops ...Operand) { o.a.op("VFMSUB132PD", ops...) } func (o Opcodes) Vfmsub132ps(ops ...Operand) { o.a.op("VFMSUB132PS", ops...) } func (o Opcodes) VFMSUB132PS(ops ...Operand) { o.a.op("VFMSUB132PS", ops...) } func (o Opcodes) Vfmsub132sd(ops ...Operand) { o.a.op("VFMSUB132SD", ops...) } func (o Opcodes) VFMSUB132SD(ops ...Operand) { o.a.op("VFMSUB132SD", ops...) } func (o Opcodes) Vfmsub132ss(ops ...Operand) { o.a.op("VFMSUB132SS", ops...) } func (o Opcodes) VFMSUB132SS(ops ...Operand) { o.a.op("VFMSUB132SS", ops...) } func (o Opcodes) Vfmsub213pd(ops ...Operand) { o.a.op("VFMSUB213PD", ops...) } func (o Opcodes) VFMSUB213PD(ops ...Operand) { o.a.op("VFMSUB213PD", ops...) } func (o Opcodes) Vfmsub213ps(ops ...Operand) { o.a.op("VFMSUB213PS", ops...) } func (o Opcodes) VFMSUB213PS(ops ...Operand) { o.a.op("VFMSUB213PS", ops...) } func (o Opcodes) Vfmsub213sd(ops ...Operand) { o.a.op("VFMSUB213SD", ops...) } func (o Opcodes) VFMSUB213SD(ops ...Operand) { o.a.op("VFMSUB213SD", ops...) } func (o Opcodes) Vfmsub213ss(ops ...Operand) { o.a.op("VFMSUB213SS", ops...) } func (o Opcodes) VFMSUB213SS(ops ...Operand) { o.a.op("VFMSUB213SS", ops...) } func (o Opcodes) Vfmsub231pd(ops ...Operand) { o.a.op("VFMSUB231PD", ops...) } func (o Opcodes) VFMSUB231PD(ops ...Operand) { o.a.op("VFMSUB231PD", ops...) } func (o Opcodes) Vfmsub231ps(ops ...Operand) { o.a.op("VFMSUB231PS", ops...) } func (o Opcodes) VFMSUB231PS(ops ...Operand) { o.a.op("VFMSUB231PS", ops...) } func (o Opcodes) Vfmsub231sd(ops ...Operand) { o.a.op("VFMSUB231SD", ops...) } func (o Opcodes) VFMSUB231SD(ops ...Operand) { o.a.op("VFMSUB231SD", ops...) } func (o Opcodes) Vfmsub231ss(ops ...Operand) { o.a.op("VFMSUB231SS", ops...) } func (o Opcodes) VFMSUB231SS(ops ...Operand) { o.a.op("VFMSUB231SS", ops...) } func (o Opcodes) Vfmsubadd132pd(ops ...Operand) { o.a.op("VFMSUBADD132PD", ops...) } func (o Opcodes) VFMSUBADD132PD(ops ...Operand) { o.a.op("VFMSUBADD132PD", ops...) } func (o Opcodes) Vfmsubadd132ps(ops ...Operand) { o.a.op("VFMSUBADD132PS", ops...) } func (o Opcodes) VFMSUBADD132PS(ops ...Operand) { o.a.op("VFMSUBADD132PS", ops...) } func (o Opcodes) Vfmsubadd213pd(ops ...Operand) { o.a.op("VFMSUBADD213PD", ops...) } func (o Opcodes) VFMSUBADD213PD(ops ...Operand) { o.a.op("VFMSUBADD213PD", ops...) } func (o Opcodes) Vfmsubadd213ps(ops ...Operand) { o.a.op("VFMSUBADD213PS", ops...) } func (o Opcodes) VFMSUBADD213PS(ops ...Operand) { o.a.op("VFMSUBADD213PS", ops...) } func (o Opcodes) Vfmsubadd231pd(ops ...Operand) { o.a.op("VFMSUBADD231PD", ops...) } func (o Opcodes) VFMSUBADD231PD(ops ...Operand) { o.a.op("VFMSUBADD231PD", ops...) } func (o Opcodes) Vfmsubadd231ps(ops ...Operand) { o.a.op("VFMSUBADD231PS", ops...) } func (o Opcodes) VFMSUBADD231PS(ops ...Operand) { o.a.op("VFMSUBADD231PS", ops...) } func (o Opcodes) Vfnmadd132pd(ops ...Operand) { o.a.op("VFNMADD132PD", ops...) } func (o Opcodes) VFNMADD132PD(ops ...Operand) { o.a.op("VFNMADD132PD", ops...) } func (o Opcodes) Vfnmadd132ps(ops ...Operand) { o.a.op("VFNMADD132PS", ops...) } func (o Opcodes) VFNMADD132PS(ops ...Operand) { o.a.op("VFNMADD132PS", ops...) } func (o Opcodes) Vfnmadd132sd(ops ...Operand) { o.a.op("VFNMADD132SD", ops...) } func (o Opcodes) VFNMADD132SD(ops ...Operand) { o.a.op("VFNMADD132SD", ops...) } func (o Opcodes) Vfnmadd132ss(ops ...Operand) { o.a.op("VFNMADD132SS", ops...) } func (o Opcodes) VFNMADD132SS(ops ...Operand) { o.a.op("VFNMADD132SS", ops...) } func (o Opcodes) Vfnmadd213pd(ops ...Operand) { o.a.op("VFNMADD213PD", ops...) } func (o Opcodes) VFNMADD213PD(ops ...Operand) { o.a.op("VFNMADD213PD", ops...) } func (o Opcodes) Vfnmadd213ps(ops ...Operand) { o.a.op("VFNMADD213PS", ops...) } func (o Opcodes) VFNMADD213PS(ops ...Operand) { o.a.op("VFNMADD213PS", ops...) } func (o Opcodes) Vfnmadd213sd(ops ...Operand) { o.a.op("VFNMADD213SD", ops...) } func (o Opcodes) VFNMADD213SD(ops ...Operand) { o.a.op("VFNMADD213SD", ops...) } func (o Opcodes) Vfnmadd213ss(ops ...Operand) { o.a.op("VFNMADD213SS", ops...) } func (o Opcodes) VFNMADD213SS(ops ...Operand) { o.a.op("VFNMADD213SS", ops...) } func (o Opcodes) Vfnmadd231pd(ops ...Operand) { o.a.op("VFNMADD231PD", ops...) } func (o Opcodes) VFNMADD231PD(ops ...Operand) { o.a.op("VFNMADD231PD", ops...) } func (o Opcodes) Vfnmadd231ps(ops ...Operand) { o.a.op("VFNMADD231PS", ops...) } func (o Opcodes) VFNMADD231PS(ops ...Operand) { o.a.op("VFNMADD231PS", ops...) } func (o Opcodes) Vfnmadd231sd(ops ...Operand) { o.a.op("VFNMADD231SD", ops...) } func (o Opcodes) VFNMADD231SD(ops ...Operand) { o.a.op("VFNMADD231SD", ops...) } func (o Opcodes) Vfnmadd231ss(ops ...Operand) { o.a.op("VFNMADD231SS", ops...) } func (o Opcodes) VFNMADD231SS(ops ...Operand) { o.a.op("VFNMADD231SS", ops...) } func (o Opcodes) Vfnmsub132pd(ops ...Operand) { o.a.op("VFNMSUB132PD", ops...) } func (o Opcodes) VFNMSUB132PD(ops ...Operand) { o.a.op("VFNMSUB132PD", ops...) } func (o Opcodes) Vfnmsub132ps(ops ...Operand) { o.a.op("VFNMSUB132PS", ops...) } func (o Opcodes) VFNMSUB132PS(ops ...Operand) { o.a.op("VFNMSUB132PS", ops...) } func (o Opcodes) Vfnmsub132sd(ops ...Operand) { o.a.op("VFNMSUB132SD", ops...) } func (o Opcodes) VFNMSUB132SD(ops ...Operand) { o.a.op("VFNMSUB132SD", ops...) } func (o Opcodes) Vfnmsub132ss(ops ...Operand) { o.a.op("VFNMSUB132SS", ops...) } func (o Opcodes) VFNMSUB132SS(ops ...Operand) { o.a.op("VFNMSUB132SS", ops...) } func (o Opcodes) Vfnmsub213pd(ops ...Operand) { o.a.op("VFNMSUB213PD", ops...) } func (o Opcodes) VFNMSUB213PD(ops ...Operand) { o.a.op("VFNMSUB213PD", ops...) } func (o Opcodes) Vfnmsub213ps(ops ...Operand) { o.a.op("VFNMSUB213PS", ops...) } func (o Opcodes) VFNMSUB213PS(ops ...Operand) { o.a.op("VFNMSUB213PS", ops...) } func (o Opcodes) Vfnmsub213sd(ops ...Operand) { o.a.op("VFNMSUB213SD", ops...) } func (o Opcodes) VFNMSUB213SD(ops ...Operand) { o.a.op("VFNMSUB213SD", ops...) } func (o Opcodes) Vfnmsub213ss(ops ...Operand) { o.a.op("VFNMSUB213SS", ops...) } func (o Opcodes) VFNMSUB213SS(ops ...Operand) { o.a.op("VFNMSUB213SS", ops...) } func (o Opcodes) Vfnmsub231pd(ops ...Operand) { o.a.op("VFNMSUB231PD", ops...) } func (o Opcodes) VFNMSUB231PD(ops ...Operand) { o.a.op("VFNMSUB231PD", ops...) } func (o Opcodes) Vfnmsub231ps(ops ...Operand) { o.a.op("VFNMSUB231PS", ops...) } func (o Opcodes) VFNMSUB231PS(ops ...Operand) { o.a.op("VFNMSUB231PS", ops...) } func (o Opcodes) Vfnmsub231sd(ops ...Operand) { o.a.op("VFNMSUB231SD", ops...) } func (o Opcodes) VFNMSUB231SD(ops ...Operand) { o.a.op("VFNMSUB231SD", ops...) } func (o Opcodes) Vfnmsub231ss(ops ...Operand) { o.a.op("VFNMSUB231SS", ops...) } func (o Opcodes) VFNMSUB231SS(ops ...Operand) { o.a.op("VFNMSUB231SS", ops...) } func (o Opcodes) Vfpclasspd(ops ...Operand) { o.a.op("VFPCLASSPD", ops...) } func (o Opcodes) VFPCLASSPD(ops ...Operand) { o.a.op("VFPCLASSPD", ops...) } func (o Opcodes) Vfpclasspdx(ops ...Operand) { o.a.op("VFPCLASSPDX", ops...) } func (o Opcodes) VFPCLASSPDX(ops ...Operand) { o.a.op("VFPCLASSPDX", ops...) } func (o Opcodes) Vfpclasspdy(ops ...Operand) { o.a.op("VFPCLASSPDY", ops...) } func (o Opcodes) VFPCLASSPDY(ops ...Operand) { o.a.op("VFPCLASSPDY", ops...) } func (o Opcodes) Vfpclasspdz(ops ...Operand) { o.a.op("VFPCLASSPDZ", ops...) } func (o Opcodes) VFPCLASSPDZ(ops ...Operand) { o.a.op("VFPCLASSPDZ", ops...) } func (o Opcodes) Vfpclassps(ops ...Operand) { o.a.op("VFPCLASSPS", ops...) } func (o Opcodes) VFPCLASSPS(ops ...Operand) { o.a.op("VFPCLASSPS", ops...) } func (o Opcodes) Vfpclasspsx(ops ...Operand) { o.a.op("VFPCLASSPSX", ops...) } func (o Opcodes) VFPCLASSPSX(ops ...Operand) { o.a.op("VFPCLASSPSX", ops...) } func (o Opcodes) Vfpclasspsy(ops ...Operand) { o.a.op("VFPCLASSPSY", ops...) } func (o Opcodes) VFPCLASSPSY(ops ...Operand) { o.a.op("VFPCLASSPSY", ops...) } func (o Opcodes) Vfpclasspsz(ops ...Operand) { o.a.op("VFPCLASSPSZ", ops...) } func (o Opcodes) VFPCLASSPSZ(ops ...Operand) { o.a.op("VFPCLASSPSZ", ops...) } func (o Opcodes) Vfpclasssd(ops ...Operand) { o.a.op("VFPCLASSSD", ops...) } func (o Opcodes) VFPCLASSSD(ops ...Operand) { o.a.op("VFPCLASSSD", ops...) } func (o Opcodes) Vfpclassss(ops ...Operand) { o.a.op("VFPCLASSSS", ops...) } func (o Opcodes) VFPCLASSSS(ops ...Operand) { o.a.op("VFPCLASSSS", ops...) } func (o Opcodes) Vgatherdpd(ops ...Operand) { o.a.op("VGATHERDPD", ops...) } func (o Opcodes) VGATHERDPD(ops ...Operand) { o.a.op("VGATHERDPD", ops...) } func (o Opcodes) Vgatherdps(ops ...Operand) { o.a.op("VGATHERDPS", ops...) } func (o Opcodes) VGATHERDPS(ops ...Operand) { o.a.op("VGATHERDPS", ops...) } func (o Opcodes) Vgatherpf0dpd(ops ...Operand) { o.a.op("VGATHERPF0DPD", ops...) } func (o Opcodes) VGATHERPF0DPD(ops ...Operand) { o.a.op("VGATHERPF0DPD", ops...) } func (o Opcodes) Vgatherpf0dps(ops ...Operand) { o.a.op("VGATHERPF0DPS", ops...) } func (o Opcodes) VGATHERPF0DPS(ops ...Operand) { o.a.op("VGATHERPF0DPS", ops...) } func (o Opcodes) Vgatherpf0qpd(ops ...Operand) { o.a.op("VGATHERPF0QPD", ops...) } func (o Opcodes) VGATHERPF0QPD(ops ...Operand) { o.a.op("VGATHERPF0QPD", ops...) } func (o Opcodes) Vgatherpf0qps(ops ...Operand) { o.a.op("VGATHERPF0QPS", ops...) } func (o Opcodes) VGATHERPF0QPS(ops ...Operand) { o.a.op("VGATHERPF0QPS", ops...) } func (o Opcodes) Vgatherpf1dpd(ops ...Operand) { o.a.op("VGATHERPF1DPD", ops...) } func (o Opcodes) VGATHERPF1DPD(ops ...Operand) { o.a.op("VGATHERPF1DPD", ops...) } func (o Opcodes) Vgatherpf1dps(ops ...Operand) { o.a.op("VGATHERPF1DPS", ops...) } func (o Opcodes) VGATHERPF1DPS(ops ...Operand) { o.a.op("VGATHERPF1DPS", ops...) } func (o Opcodes) Vgatherpf1qpd(ops ...Operand) { o.a.op("VGATHERPF1QPD", ops...) } func (o Opcodes) VGATHERPF1QPD(ops ...Operand) { o.a.op("VGATHERPF1QPD", ops...) } func (o Opcodes) Vgatherpf1qps(ops ...Operand) { o.a.op("VGATHERPF1QPS", ops...) } func (o Opcodes) VGATHERPF1QPS(ops ...Operand) { o.a.op("VGATHERPF1QPS", ops...) } func (o Opcodes) Vgatherqpd(ops ...Operand) { o.a.op("VGATHERQPD", ops...) } func (o Opcodes) VGATHERQPD(ops ...Operand) { o.a.op("VGATHERQPD", ops...) } func (o Opcodes) Vgatherqps(ops ...Operand) { o.a.op("VGATHERQPS", ops...) } func (o Opcodes) VGATHERQPS(ops ...Operand) { o.a.op("VGATHERQPS", ops...) } func (o Opcodes) Vgetexppd(ops ...Operand) { o.a.op("VGETEXPPD", ops...) } func (o Opcodes) VGETEXPPD(ops ...Operand) { o.a.op("VGETEXPPD", ops...) } func (o Opcodes) Vgetexpps(ops ...Operand) { o.a.op("VGETEXPPS", ops...) } func (o Opcodes) VGETEXPPS(ops ...Operand) { o.a.op("VGETEXPPS", ops...) } func (o Opcodes) Vgetexpsd(ops ...Operand) { o.a.op("VGETEXPSD", ops...) } func (o Opcodes) VGETEXPSD(ops ...Operand) { o.a.op("VGETEXPSD", ops...) } func (o Opcodes) Vgetexpss(ops ...Operand) { o.a.op("VGETEXPSS", ops...) } func (o Opcodes) VGETEXPSS(ops ...Operand) { o.a.op("VGETEXPSS", ops...) } func (o Opcodes) Vgetmantpd(ops ...Operand) { o.a.op("VGETMANTPD", ops...) } func (o Opcodes) VGETMANTPD(ops ...Operand) { o.a.op("VGETMANTPD", ops...) } func (o Opcodes) Vgetmantps(ops ...Operand) { o.a.op("VGETMANTPS", ops...) } func (o Opcodes) VGETMANTPS(ops ...Operand) { o.a.op("VGETMANTPS", ops...) } func (o Opcodes) Vgetmantsd(ops ...Operand) { o.a.op("VGETMANTSD", ops...) } func (o Opcodes) VGETMANTSD(ops ...Operand) { o.a.op("VGETMANTSD", ops...) } func (o Opcodes) Vgetmantss(ops ...Operand) { o.a.op("VGETMANTSS", ops...) } func (o Opcodes) VGETMANTSS(ops ...Operand) { o.a.op("VGETMANTSS", ops...) } func (o Opcodes) Vgf2p8affineinvqb(ops ...Operand) { o.a.op("VGF2P8AFFINEINVQB", ops...) } func (o Opcodes) VGF2P8AFFINEINVQB(ops ...Operand) { o.a.op("VGF2P8AFFINEINVQB", ops...) } func (o Opcodes) Vgf2p8affineqb(ops ...Operand) { o.a.op("VGF2P8AFFINEQB", ops...) } func (o Opcodes) VGF2P8AFFINEQB(ops ...Operand) { o.a.op("VGF2P8AFFINEQB", ops...) } func (o Opcodes) Vgf2p8mulb(ops ...Operand) { o.a.op("VGF2P8MULB", ops...) } func (o Opcodes) VGF2P8MULB(ops ...Operand) { o.a.op("VGF2P8MULB", ops...) } func (o Opcodes) Vhaddpd(ops ...Operand) { o.a.op("VHADDPD", ops...) } func (o Opcodes) VHADDPD(ops ...Operand) { o.a.op("VHADDPD", ops...) } func (o Opcodes) Vhaddps(ops ...Operand) { o.a.op("VHADDPS", ops...) } func (o Opcodes) VHADDPS(ops ...Operand) { o.a.op("VHADDPS", ops...) } func (o Opcodes) Vhsubpd(ops ...Operand) { o.a.op("VHSUBPD", ops...) } func (o Opcodes) VHSUBPD(ops ...Operand) { o.a.op("VHSUBPD", ops...) } func (o Opcodes) Vhsubps(ops ...Operand) { o.a.op("VHSUBPS", ops...) } func (o Opcodes) VHSUBPS(ops ...Operand) { o.a.op("VHSUBPS", ops...) } func (o Opcodes) Vinsertf128(ops ...Operand) { o.a.op("VINSERTF128", ops...) } func (o Opcodes) VINSERTF128(ops ...Operand) { o.a.op("VINSERTF128", ops...) } func (o Opcodes) Vinsertf32x4(ops ...Operand) { o.a.op("VINSERTF32X4", ops...) } func (o Opcodes) VINSERTF32X4(ops ...Operand) { o.a.op("VINSERTF32X4", ops...) } func (o Opcodes) Vinsertf32x8(ops ...Operand) { o.a.op("VINSERTF32X8", ops...) } func (o Opcodes) VINSERTF32X8(ops ...Operand) { o.a.op("VINSERTF32X8", ops...) } func (o Opcodes) Vinsertf64x2(ops ...Operand) { o.a.op("VINSERTF64X2", ops...) } func (o Opcodes) VINSERTF64X2(ops ...Operand) { o.a.op("VINSERTF64X2", ops...) } func (o Opcodes) Vinsertf64x4(ops ...Operand) { o.a.op("VINSERTF64X4", ops...) } func (o Opcodes) VINSERTF64X4(ops ...Operand) { o.a.op("VINSERTF64X4", ops...) } func (o Opcodes) Vinserti128(ops ...Operand) { o.a.op("VINSERTI128", ops...) } func (o Opcodes) VINSERTI128(ops ...Operand) { o.a.op("VINSERTI128", ops...) } func (o Opcodes) Vinserti32x4(ops ...Operand) { o.a.op("VINSERTI32X4", ops...) } func (o Opcodes) VINSERTI32X4(ops ...Operand) { o.a.op("VINSERTI32X4", ops...) } func (o Opcodes) Vinserti32x8(ops ...Operand) { o.a.op("VINSERTI32X8", ops...) } func (o Opcodes) VINSERTI32X8(ops ...Operand) { o.a.op("VINSERTI32X8", ops...) } func (o Opcodes) Vinserti64x2(ops ...Operand) { o.a.op("VINSERTI64X2", ops...) } func (o Opcodes) VINSERTI64X2(ops ...Operand) { o.a.op("VINSERTI64X2", ops...) } func (o Opcodes) Vinserti64x4(ops ...Operand) { o.a.op("VINSERTI64X4", ops...) } func (o Opcodes) VINSERTI64X4(ops ...Operand) { o.a.op("VINSERTI64X4", ops...) } func (o Opcodes) Vinsertps(ops ...Operand) { o.a.op("VINSERTPS", ops...) } func (o Opcodes) VINSERTPS(ops ...Operand) { o.a.op("VINSERTPS", ops...) } func (o Opcodes) Vlddqu(ops ...Operand) { o.a.op("VLDDQU", ops...) } func (o Opcodes) VLDDQU(ops ...Operand) { o.a.op("VLDDQU", ops...) } func (o Opcodes) Vldmxcsr(ops ...Operand) { o.a.op("VLDMXCSR", ops...) } func (o Opcodes) VLDMXCSR(ops ...Operand) { o.a.op("VLDMXCSR", ops...) } func (o Opcodes) Vmaskmovdqu(ops ...Operand) { o.a.op("VMASKMOVDQU", ops...) } func (o Opcodes) VMASKMOVDQU(ops ...Operand) { o.a.op("VMASKMOVDQU", ops...) } func (o Opcodes) Vmaskmovpd(ops ...Operand) { o.a.op("VMASKMOVPD", ops...) } func (o Opcodes) VMASKMOVPD(ops ...Operand) { o.a.op("VMASKMOVPD", ops...) } func (o Opcodes) Vmaskmovps(ops ...Operand) { o.a.op("VMASKMOVPS", ops...) } func (o Opcodes) VMASKMOVPS(ops ...Operand) { o.a.op("VMASKMOVPS", ops...) } func (o Opcodes) Vmaxpd(ops ...Operand) { o.a.op("VMAXPD", ops...) } func (o Opcodes) VMAXPD(ops ...Operand) { o.a.op("VMAXPD", ops...) } func (o Opcodes) Vmaxps(ops ...Operand) { o.a.op("VMAXPS", ops...) } func (o Opcodes) VMAXPS(ops ...Operand) { o.a.op("VMAXPS", ops...) } func (o Opcodes) Vmaxsd(ops ...Operand) { o.a.op("VMAXSD", ops...) } func (o Opcodes) VMAXSD(ops ...Operand) { o.a.op("VMAXSD", ops...) } func (o Opcodes) Vmaxss(ops ...Operand) { o.a.op("VMAXSS", ops...) } func (o Opcodes) VMAXSS(ops ...Operand) { o.a.op("VMAXSS", ops...) } func (o Opcodes) Vminpd(ops ...Operand) { o.a.op("VMINPD", ops...) } func (o Opcodes) VMINPD(ops ...Operand) { o.a.op("VMINPD", ops...) } func (o Opcodes) Vminps(ops ...Operand) { o.a.op("VMINPS", ops...) } func (o Opcodes) VMINPS(ops ...Operand) { o.a.op("VMINPS", ops...) } func (o Opcodes) Vminsd(ops ...Operand) { o.a.op("VMINSD", ops...) } func (o Opcodes) VMINSD(ops ...Operand) { o.a.op("VMINSD", ops...) } func (o Opcodes) Vminss(ops ...Operand) { o.a.op("VMINSS", ops...) } func (o Opcodes) VMINSS(ops ...Operand) { o.a.op("VMINSS", ops...) } func (o Opcodes) Vmovapd(ops ...Operand) { o.a.op("VMOVAPD", ops...) } func (o Opcodes) VMOVAPD(ops ...Operand) { o.a.op("VMOVAPD", ops...) } func (o Opcodes) Vmovaps(ops ...Operand) { o.a.op("VMOVAPS", ops...) } func (o Opcodes) VMOVAPS(ops ...Operand) { o.a.op("VMOVAPS", ops...) } func (o Opcodes) Vmovd(ops ...Operand) { o.a.op("VMOVD", ops...) } func (o Opcodes) VMOVD(ops ...Operand) { o.a.op("VMOVD", ops...) } func (o Opcodes) Vmovddup(ops ...Operand) { o.a.op("VMOVDDUP", ops...) } func (o Opcodes) VMOVDDUP(ops ...Operand) { o.a.op("VMOVDDUP", ops...) } func (o Opcodes) Vmovdqa(ops ...Operand) { o.a.op("VMOVDQA", ops...) } func (o Opcodes) VMOVDQA(ops ...Operand) { o.a.op("VMOVDQA", ops...) } func (o Opcodes) Vmovdqa32(ops ...Operand) { o.a.op("VMOVDQA32", ops...) } func (o Opcodes) VMOVDQA32(ops ...Operand) { o.a.op("VMOVDQA32", ops...) } func (o Opcodes) Vmovdqa64(ops ...Operand) { o.a.op("VMOVDQA64", ops...) } func (o Opcodes) VMOVDQA64(ops ...Operand) { o.a.op("VMOVDQA64", ops...) } func (o Opcodes) Vmovdqu(ops ...Operand) { o.a.op("VMOVDQU", ops...) } func (o Opcodes) VMOVDQU(ops ...Operand) { o.a.op("VMOVDQU", ops...) } func (o Opcodes) Vmovdqu16(ops ...Operand) { o.a.op("VMOVDQU16", ops...) } func (o Opcodes) VMOVDQU16(ops ...Operand) { o.a.op("VMOVDQU16", ops...) } func (o Opcodes) Vmovdqu32(ops ...Operand) { o.a.op("VMOVDQU32", ops...) } func (o Opcodes) VMOVDQU32(ops ...Operand) { o.a.op("VMOVDQU32", ops...) } func (o Opcodes) Vmovdqu64(ops ...Operand) { o.a.op("VMOVDQU64", ops...) } func (o Opcodes) VMOVDQU64(ops ...Operand) { o.a.op("VMOVDQU64", ops...) } func (o Opcodes) Vmovdqu8(ops ...Operand) { o.a.op("VMOVDQU8", ops...) } func (o Opcodes) VMOVDQU8(ops ...Operand) { o.a.op("VMOVDQU8", ops...) } func (o Opcodes) Vmovhlps(ops ...Operand) { o.a.op("VMOVHLPS", ops...) } func (o Opcodes) VMOVHLPS(ops ...Operand) { o.a.op("VMOVHLPS", ops...) } func (o Opcodes) Vmovhpd(ops ...Operand) { o.a.op("VMOVHPD", ops...) } func (o Opcodes) VMOVHPD(ops ...Operand) { o.a.op("VMOVHPD", ops...) } func (o Opcodes) Vmovhps(ops ...Operand) { o.a.op("VMOVHPS", ops...) } func (o Opcodes) VMOVHPS(ops ...Operand) { o.a.op("VMOVHPS", ops...) } func (o Opcodes) Vmovlhps(ops ...Operand) { o.a.op("VMOVLHPS", ops...) } func (o Opcodes) VMOVLHPS(ops ...Operand) { o.a.op("VMOVLHPS", ops...) } func (o Opcodes) Vmovlpd(ops ...Operand) { o.a.op("VMOVLPD", ops...) } func (o Opcodes) VMOVLPD(ops ...Operand) { o.a.op("VMOVLPD", ops...) } func (o Opcodes) Vmovlps(ops ...Operand) { o.a.op("VMOVLPS", ops...) } func (o Opcodes) VMOVLPS(ops ...Operand) { o.a.op("VMOVLPS", ops...) } func (o Opcodes) Vmovmskpd(ops ...Operand) { o.a.op("VMOVMSKPD", ops...) } func (o Opcodes) VMOVMSKPD(ops ...Operand) { o.a.op("VMOVMSKPD", ops...) } func (o Opcodes) Vmovmskps(ops ...Operand) { o.a.op("VMOVMSKPS", ops...) } func (o Opcodes) VMOVMSKPS(ops ...Operand) { o.a.op("VMOVMSKPS", ops...) } func (o Opcodes) Vmovntdq(ops ...Operand) { o.a.op("VMOVNTDQ", ops...) } func (o Opcodes) VMOVNTDQ(ops ...Operand) { o.a.op("VMOVNTDQ", ops...) } func (o Opcodes) Vmovntdqa(ops ...Operand) { o.a.op("VMOVNTDQA", ops...) } func (o Opcodes) VMOVNTDQA(ops ...Operand) { o.a.op("VMOVNTDQA", ops...) } func (o Opcodes) Vmovntpd(ops ...Operand) { o.a.op("VMOVNTPD", ops...) } func (o Opcodes) VMOVNTPD(ops ...Operand) { o.a.op("VMOVNTPD", ops...) } func (o Opcodes) Vmovntps(ops ...Operand) { o.a.op("VMOVNTPS", ops...) } func (o Opcodes) VMOVNTPS(ops ...Operand) { o.a.op("VMOVNTPS", ops...) } func (o Opcodes) Vmovq(ops ...Operand) { o.a.op("VMOVQ", ops...) } func (o Opcodes) VMOVQ(ops ...Operand) { o.a.op("VMOVQ", ops...) } func (o Opcodes) Vmovsd(ops ...Operand) { o.a.op("VMOVSD", ops...) } func (o Opcodes) VMOVSD(ops ...Operand) { o.a.op("VMOVSD", ops...) } func (o Opcodes) Vmovshdup(ops ...Operand) { o.a.op("VMOVSHDUP", ops...) } func (o Opcodes) VMOVSHDUP(ops ...Operand) { o.a.op("VMOVSHDUP", ops...) } func (o Opcodes) Vmovsldup(ops ...Operand) { o.a.op("VMOVSLDUP", ops...) } func (o Opcodes) VMOVSLDUP(ops ...Operand) { o.a.op("VMOVSLDUP", ops...) } func (o Opcodes) Vmovss(ops ...Operand) { o.a.op("VMOVSS", ops...) } func (o Opcodes) VMOVSS(ops ...Operand) { o.a.op("VMOVSS", ops...) } func (o Opcodes) Vmovupd(ops ...Operand) { o.a.op("VMOVUPD", ops...) } func (o Opcodes) VMOVUPD(ops ...Operand) { o.a.op("VMOVUPD", ops...) } func (o Opcodes) Vmovups(ops ...Operand) { o.a.op("VMOVUPS", ops...) } func (o Opcodes) VMOVUPS(ops ...Operand) { o.a.op("VMOVUPS", ops...) } func (o Opcodes) Vmpsadbw(ops ...Operand) { o.a.op("VMPSADBW", ops...) } func (o Opcodes) VMPSADBW(ops ...Operand) { o.a.op("VMPSADBW", ops...) } func (o Opcodes) Vmulpd(ops ...Operand) { o.a.op("VMULPD", ops...) } func (o Opcodes) VMULPD(ops ...Operand) { o.a.op("VMULPD", ops...) } func (o Opcodes) Vmulps(ops ...Operand) { o.a.op("VMULPS", ops...) } func (o Opcodes) VMULPS(ops ...Operand) { o.a.op("VMULPS", ops...) } func (o Opcodes) Vmulsd(ops ...Operand) { o.a.op("VMULSD", ops...) } func (o Opcodes) VMULSD(ops ...Operand) { o.a.op("VMULSD", ops...) } func (o Opcodes) Vmulss(ops ...Operand) { o.a.op("VMULSS", ops...) } func (o Opcodes) VMULSS(ops ...Operand) { o.a.op("VMULSS", ops...) } func (o Opcodes) Vorpd(ops ...Operand) { o.a.op("VORPD", ops...) } func (o Opcodes) VORPD(ops ...Operand) { o.a.op("VORPD", ops...) } func (o Opcodes) Vorps(ops ...Operand) { o.a.op("VORPS", ops...) } func (o Opcodes) VORPS(ops ...Operand) { o.a.op("VORPS", ops...) } func (o Opcodes) Vp4dpwssd(ops ...Operand) { o.a.op("VP4DPWSSD", ops...) } func (o Opcodes) VP4DPWSSD(ops ...Operand) { o.a.op("VP4DPWSSD", ops...) } func (o Opcodes) Vp4dpwssds(ops ...Operand) { o.a.op("VP4DPWSSDS", ops...) } func (o Opcodes) VP4DPWSSDS(ops ...Operand) { o.a.op("VP4DPWSSDS", ops...) } func (o Opcodes) Vpabsb(ops ...Operand) { o.a.op("VPABSB", ops...) } func (o Opcodes) VPABSB(ops ...Operand) { o.a.op("VPABSB", ops...) } func (o Opcodes) Vpabsd(ops ...Operand) { o.a.op("VPABSD", ops...) } func (o Opcodes) VPABSD(ops ...Operand) { o.a.op("VPABSD", ops...) } func (o Opcodes) Vpabsq(ops ...Operand) { o.a.op("VPABSQ", ops...) } func (o Opcodes) VPABSQ(ops ...Operand) { o.a.op("VPABSQ", ops...) } func (o Opcodes) Vpabsw(ops ...Operand) { o.a.op("VPABSW", ops...) } func (o Opcodes) VPABSW(ops ...Operand) { o.a.op("VPABSW", ops...) } func (o Opcodes) Vpackssdw(ops ...Operand) { o.a.op("VPACKSSDW", ops...) } func (o Opcodes) VPACKSSDW(ops ...Operand) { o.a.op("VPACKSSDW", ops...) } func (o Opcodes) Vpacksswb(ops ...Operand) { o.a.op("VPACKSSWB", ops...) } func (o Opcodes) VPACKSSWB(ops ...Operand) { o.a.op("VPACKSSWB", ops...) } func (o Opcodes) Vpackusdw(ops ...Operand) { o.a.op("VPACKUSDW", ops...) } func (o Opcodes) VPACKUSDW(ops ...Operand) { o.a.op("VPACKUSDW", ops...) } func (o Opcodes) Vpackuswb(ops ...Operand) { o.a.op("VPACKUSWB", ops...) } func (o Opcodes) VPACKUSWB(ops ...Operand) { o.a.op("VPACKUSWB", ops...) } func (o Opcodes) Vpaddb(ops ...Operand) { o.a.op("VPADDB", ops...) } func (o Opcodes) VPADDB(ops ...Operand) { o.a.op("VPADDB", ops...) } func (o Opcodes) Vpaddd(ops ...Operand) { o.a.op("VPADDD", ops...) } func (o Opcodes) VPADDD(ops ...Operand) { o.a.op("VPADDD", ops...) } func (o Opcodes) Vpaddq(ops ...Operand) { o.a.op("VPADDQ", ops...) } func (o Opcodes) VPADDQ(ops ...Operand) { o.a.op("VPADDQ", ops...) } func (o Opcodes) Vpaddsb(ops ...Operand) { o.a.op("VPADDSB", ops...) } func (o Opcodes) VPADDSB(ops ...Operand) { o.a.op("VPADDSB", ops...) } func (o Opcodes) Vpaddsw(ops ...Operand) { o.a.op("VPADDSW", ops...) } func (o Opcodes) VPADDSW(ops ...Operand) { o.a.op("VPADDSW", ops...) } func (o Opcodes) Vpaddusb(ops ...Operand) { o.a.op("VPADDUSB", ops...) } func (o Opcodes) VPADDUSB(ops ...Operand) { o.a.op("VPADDUSB", ops...) } func (o Opcodes) Vpaddusw(ops ...Operand) { o.a.op("VPADDUSW", ops...) } func (o Opcodes) VPADDUSW(ops ...Operand) { o.a.op("VPADDUSW", ops...) } func (o Opcodes) Vpaddw(ops ...Operand) { o.a.op("VPADDW", ops...) } func (o Opcodes) VPADDW(ops ...Operand) { o.a.op("VPADDW", ops...) } func (o Opcodes) Vpalignr(ops ...Operand) { o.a.op("VPALIGNR", ops...) } func (o Opcodes) VPALIGNR(ops ...Operand) { o.a.op("VPALIGNR", ops...) } func (o Opcodes) Vpand(ops ...Operand) { o.a.op("VPAND", ops...) } func (o Opcodes) VPAND(ops ...Operand) { o.a.op("VPAND", ops...) } func (o Opcodes) Vpandd(ops ...Operand) { o.a.op("VPANDD", ops...) } func (o Opcodes) VPANDD(ops ...Operand) { o.a.op("VPANDD", ops...) } func (o Opcodes) Vpandn(ops ...Operand) { o.a.op("VPANDN", ops...) } func (o Opcodes) VPANDN(ops ...Operand) { o.a.op("VPANDN", ops...) } func (o Opcodes) Vpandnd(ops ...Operand) { o.a.op("VPANDND", ops...) } func (o Opcodes) VPANDND(ops ...Operand) { o.a.op("VPANDND", ops...) } func (o Opcodes) Vpandnq(ops ...Operand) { o.a.op("VPANDNQ", ops...) } func (o Opcodes) VPANDNQ(ops ...Operand) { o.a.op("VPANDNQ", ops...) } func (o Opcodes) Vpandq(ops ...Operand) { o.a.op("VPANDQ", ops...) } func (o Opcodes) VPANDQ(ops ...Operand) { o.a.op("VPANDQ", ops...) } func (o Opcodes) Vpavgb(ops ...Operand) { o.a.op("VPAVGB", ops...) } func (o Opcodes) VPAVGB(ops ...Operand) { o.a.op("VPAVGB", ops...) } func (o Opcodes) Vpavgw(ops ...Operand) { o.a.op("VPAVGW", ops...) } func (o Opcodes) VPAVGW(ops ...Operand) { o.a.op("VPAVGW", ops...) } func (o Opcodes) Vpblendd(ops ...Operand) { o.a.op("VPBLENDD", ops...) } func (o Opcodes) VPBLENDD(ops ...Operand) { o.a.op("VPBLENDD", ops...) } func (o Opcodes) Vpblendmb(ops ...Operand) { o.a.op("VPBLENDMB", ops...) } func (o Opcodes) VPBLENDMB(ops ...Operand) { o.a.op("VPBLENDMB", ops...) } func (o Opcodes) Vpblendmd(ops ...Operand) { o.a.op("VPBLENDMD", ops...) } func (o Opcodes) VPBLENDMD(ops ...Operand) { o.a.op("VPBLENDMD", ops...) } func (o Opcodes) Vpblendmq(ops ...Operand) { o.a.op("VPBLENDMQ", ops...) } func (o Opcodes) VPBLENDMQ(ops ...Operand) { o.a.op("VPBLENDMQ", ops...) } func (o Opcodes) Vpblendmw(ops ...Operand) { o.a.op("VPBLENDMW", ops...) } func (o Opcodes) VPBLENDMW(ops ...Operand) { o.a.op("VPBLENDMW", ops...) } func (o Opcodes) Vpblendvb(ops ...Operand) { o.a.op("VPBLENDVB", ops...) } func (o Opcodes) VPBLENDVB(ops ...Operand) { o.a.op("VPBLENDVB", ops...) } func (o Opcodes) Vpblendw(ops ...Operand) { o.a.op("VPBLENDW", ops...) } func (o Opcodes) VPBLENDW(ops ...Operand) { o.a.op("VPBLENDW", ops...) } func (o Opcodes) Vpbroadcastb(ops ...Operand) { o.a.op("VPBROADCASTB", ops...) } func (o Opcodes) VPBROADCASTB(ops ...Operand) { o.a.op("VPBROADCASTB", ops...) } func (o Opcodes) Vpbroadcastd(ops ...Operand) { o.a.op("VPBROADCASTD", ops...) } func (o Opcodes) VPBROADCASTD(ops ...Operand) { o.a.op("VPBROADCASTD", ops...) } func (o Opcodes) Vpbroadcastmb2q(ops ...Operand) { o.a.op("VPBROADCASTMB2Q", ops...) } func (o Opcodes) VPBROADCASTMB2Q(ops ...Operand) { o.a.op("VPBROADCASTMB2Q", ops...) } func (o Opcodes) Vpbroadcastmw2d(ops ...Operand) { o.a.op("VPBROADCASTMW2D", ops...) } func (o Opcodes) VPBROADCASTMW2D(ops ...Operand) { o.a.op("VPBROADCASTMW2D", ops...) } func (o Opcodes) Vpbroadcastq(ops ...Operand) { o.a.op("VPBROADCASTQ", ops...) } func (o Opcodes) VPBROADCASTQ(ops ...Operand) { o.a.op("VPBROADCASTQ", ops...) } func (o Opcodes) Vpbroadcastw(ops ...Operand) { o.a.op("VPBROADCASTW", ops...) } func (o Opcodes) VPBROADCASTW(ops ...Operand) { o.a.op("VPBROADCASTW", ops...) } func (o Opcodes) Vpclmulqdq(ops ...Operand) { o.a.op("VPCLMULQDQ", ops...) } func (o Opcodes) VPCLMULQDQ(ops ...Operand) { o.a.op("VPCLMULQDQ", ops...) } func (o Opcodes) Vpcmpb(ops ...Operand) { o.a.op("VPCMPB", ops...) } func (o Opcodes) VPCMPB(ops ...Operand) { o.a.op("VPCMPB", ops...) } func (o Opcodes) Vpcmpd(ops ...Operand) { o.a.op("VPCMPD", ops...) } func (o Opcodes) VPCMPD(ops ...Operand) { o.a.op("VPCMPD", ops...) } func (o Opcodes) Vpcmpeqb(ops ...Operand) { o.a.op("VPCMPEQB", ops...) } func (o Opcodes) VPCMPEQB(ops ...Operand) { o.a.op("VPCMPEQB", ops...) } func (o Opcodes) Vpcmpeqd(ops ...Operand) { o.a.op("VPCMPEQD", ops...) } func (o Opcodes) VPCMPEQD(ops ...Operand) { o.a.op("VPCMPEQD", ops...) } func (o Opcodes) Vpcmpeqq(ops ...Operand) { o.a.op("VPCMPEQQ", ops...) } func (o Opcodes) VPCMPEQQ(ops ...Operand) { o.a.op("VPCMPEQQ", ops...) } func (o Opcodes) Vpcmpeqw(ops ...Operand) { o.a.op("VPCMPEQW", ops...) } func (o Opcodes) VPCMPEQW(ops ...Operand) { o.a.op("VPCMPEQW", ops...) } func (o Opcodes) Vpcmpestri(ops ...Operand) { o.a.op("VPCMPESTRI", ops...) } func (o Opcodes) VPCMPESTRI(ops ...Operand) { o.a.op("VPCMPESTRI", ops...) } func (o Opcodes) Vpcmpestrm(ops ...Operand) { o.a.op("VPCMPESTRM", ops...) } func (o Opcodes) VPCMPESTRM(ops ...Operand) { o.a.op("VPCMPESTRM", ops...) } func (o Opcodes) Vpcmpgtb(ops ...Operand) { o.a.op("VPCMPGTB", ops...) } func (o Opcodes) VPCMPGTB(ops ...Operand) { o.a.op("VPCMPGTB", ops...) } func (o Opcodes) Vpcmpgtd(ops ...Operand) { o.a.op("VPCMPGTD", ops...) } func (o Opcodes) VPCMPGTD(ops ...Operand) { o.a.op("VPCMPGTD", ops...) } func (o Opcodes) Vpcmpgtq(ops ...Operand) { o.a.op("VPCMPGTQ", ops...) } func (o Opcodes) VPCMPGTQ(ops ...Operand) { o.a.op("VPCMPGTQ", ops...) } func (o Opcodes) Vpcmpgtw(ops ...Operand) { o.a.op("VPCMPGTW", ops...) } func (o Opcodes) VPCMPGTW(ops ...Operand) { o.a.op("VPCMPGTW", ops...) } func (o Opcodes) Vpcmpistri(ops ...Operand) { o.a.op("VPCMPISTRI", ops...) } func (o Opcodes) VPCMPISTRI(ops ...Operand) { o.a.op("VPCMPISTRI", ops...) } func (o Opcodes) Vpcmpistrm(ops ...Operand) { o.a.op("VPCMPISTRM", ops...) } func (o Opcodes) VPCMPISTRM(ops ...Operand) { o.a.op("VPCMPISTRM", ops...) } func (o Opcodes) Vpcmpq(ops ...Operand) { o.a.op("VPCMPQ", ops...) } func (o Opcodes) VPCMPQ(ops ...Operand) { o.a.op("VPCMPQ", ops...) } func (o Opcodes) Vpcmpub(ops ...Operand) { o.a.op("VPCMPUB", ops...) } func (o Opcodes) VPCMPUB(ops ...Operand) { o.a.op("VPCMPUB", ops...) } func (o Opcodes) Vpcmpud(ops ...Operand) { o.a.op("VPCMPUD", ops...) } func (o Opcodes) VPCMPUD(ops ...Operand) { o.a.op("VPCMPUD", ops...) } func (o Opcodes) Vpcmpuq(ops ...Operand) { o.a.op("VPCMPUQ", ops...) } func (o Opcodes) VPCMPUQ(ops ...Operand) { o.a.op("VPCMPUQ", ops...) } func (o Opcodes) Vpcmpuw(ops ...Operand) { o.a.op("VPCMPUW", ops...) } func (o Opcodes) VPCMPUW(ops ...Operand) { o.a.op("VPCMPUW", ops...) } func (o Opcodes) Vpcmpw(ops ...Operand) { o.a.op("VPCMPW", ops...) } func (o Opcodes) VPCMPW(ops ...Operand) { o.a.op("VPCMPW", ops...) } func (o Opcodes) Vpcompressb(ops ...Operand) { o.a.op("VPCOMPRESSB", ops...) } func (o Opcodes) VPCOMPRESSB(ops ...Operand) { o.a.op("VPCOMPRESSB", ops...) } func (o Opcodes) Vpcompressd(ops ...Operand) { o.a.op("VPCOMPRESSD", ops...) } func (o Opcodes) VPCOMPRESSD(ops ...Operand) { o.a.op("VPCOMPRESSD", ops...) } func (o Opcodes) Vpcompressq(ops ...Operand) { o.a.op("VPCOMPRESSQ", ops...) } func (o Opcodes) VPCOMPRESSQ(ops ...Operand) { o.a.op("VPCOMPRESSQ", ops...) } func (o Opcodes) Vpcompressw(ops ...Operand) { o.a.op("VPCOMPRESSW", ops...) } func (o Opcodes) VPCOMPRESSW(ops ...Operand) { o.a.op("VPCOMPRESSW", ops...) } func (o Opcodes) Vpconflictd(ops ...Operand) { o.a.op("VPCONFLICTD", ops...) } func (o Opcodes) VPCONFLICTD(ops ...Operand) { o.a.op("VPCONFLICTD", ops...) } func (o Opcodes) Vpconflictq(ops ...Operand) { o.a.op("VPCONFLICTQ", ops...) } func (o Opcodes) VPCONFLICTQ(ops ...Operand) { o.a.op("VPCONFLICTQ", ops...) } func (o Opcodes) Vpdpbusd(ops ...Operand) { o.a.op("VPDPBUSD", ops...) } func (o Opcodes) VPDPBUSD(ops ...Operand) { o.a.op("VPDPBUSD", ops...) } func (o Opcodes) Vpdpbusds(ops ...Operand) { o.a.op("VPDPBUSDS", ops...) } func (o Opcodes) VPDPBUSDS(ops ...Operand) { o.a.op("VPDPBUSDS", ops...) } func (o Opcodes) Vpdpwssd(ops ...Operand) { o.a.op("VPDPWSSD", ops...) } func (o Opcodes) VPDPWSSD(ops ...Operand) { o.a.op("VPDPWSSD", ops...) } func (o Opcodes) Vpdpwssds(ops ...Operand) { o.a.op("VPDPWSSDS", ops...) } func (o Opcodes) VPDPWSSDS(ops ...Operand) { o.a.op("VPDPWSSDS", ops...) } func (o Opcodes) Vperm2f128(ops ...Operand) { o.a.op("VPERM2F128", ops...) } func (o Opcodes) VPERM2F128(ops ...Operand) { o.a.op("VPERM2F128", ops...) } func (o Opcodes) Vperm2i128(ops ...Operand) { o.a.op("VPERM2I128", ops...) } func (o Opcodes) VPERM2I128(ops ...Operand) { o.a.op("VPERM2I128", ops...) } func (o Opcodes) Vpermb(ops ...Operand) { o.a.op("VPERMB", ops...) } func (o Opcodes) VPERMB(ops ...Operand) { o.a.op("VPERMB", ops...) } func (o Opcodes) Vpermd(ops ...Operand) { o.a.op("VPERMD", ops...) } func (o Opcodes) VPERMD(ops ...Operand) { o.a.op("VPERMD", ops...) } func (o Opcodes) Vpermi2b(ops ...Operand) { o.a.op("VPERMI2B", ops...) } func (o Opcodes) VPERMI2B(ops ...Operand) { o.a.op("VPERMI2B", ops...) } func (o Opcodes) Vpermi2d(ops ...Operand) { o.a.op("VPERMI2D", ops...) } func (o Opcodes) VPERMI2D(ops ...Operand) { o.a.op("VPERMI2D", ops...) } func (o Opcodes) Vpermi2pd(ops ...Operand) { o.a.op("VPERMI2PD", ops...) } func (o Opcodes) VPERMI2PD(ops ...Operand) { o.a.op("VPERMI2PD", ops...) } func (o Opcodes) Vpermi2ps(ops ...Operand) { o.a.op("VPERMI2PS", ops...) } func (o Opcodes) VPERMI2PS(ops ...Operand) { o.a.op("VPERMI2PS", ops...) } func (o Opcodes) Vpermi2q(ops ...Operand) { o.a.op("VPERMI2Q", ops...) } func (o Opcodes) VPERMI2Q(ops ...Operand) { o.a.op("VPERMI2Q", ops...) } func (o Opcodes) Vpermi2w(ops ...Operand) { o.a.op("VPERMI2W", ops...) } func (o Opcodes) VPERMI2W(ops ...Operand) { o.a.op("VPERMI2W", ops...) } func (o Opcodes) Vpermilpd(ops ...Operand) { o.a.op("VPERMILPD", ops...) } func (o Opcodes) VPERMILPD(ops ...Operand) { o.a.op("VPERMILPD", ops...) } func (o Opcodes) Vpermilps(ops ...Operand) { o.a.op("VPERMILPS", ops...) } func (o Opcodes) VPERMILPS(ops ...Operand) { o.a.op("VPERMILPS", ops...) } func (o Opcodes) Vpermpd(ops ...Operand) { o.a.op("VPERMPD", ops...) } func (o Opcodes) VPERMPD(ops ...Operand) { o.a.op("VPERMPD", ops...) } func (o Opcodes) Vpermps(ops ...Operand) { o.a.op("VPERMPS", ops...) } func (o Opcodes) VPERMPS(ops ...Operand) { o.a.op("VPERMPS", ops...) } func (o Opcodes) Vpermq(ops ...Operand) { o.a.op("VPERMQ", ops...) } func (o Opcodes) VPERMQ(ops ...Operand) { o.a.op("VPERMQ", ops...) } func (o Opcodes) Vpermt2b(ops ...Operand) { o.a.op("VPERMT2B", ops...) } func (o Opcodes) VPERMT2B(ops ...Operand) { o.a.op("VPERMT2B", ops...) } func (o Opcodes) Vpermt2d(ops ...Operand) { o.a.op("VPERMT2D", ops...) } func (o Opcodes) VPERMT2D(ops ...Operand) { o.a.op("VPERMT2D", ops...) } func (o Opcodes) Vpermt2pd(ops ...Operand) { o.a.op("VPERMT2PD", ops...) } func (o Opcodes) VPERMT2PD(ops ...Operand) { o.a.op("VPERMT2PD", ops...) } func (o Opcodes) Vpermt2ps(ops ...Operand) { o.a.op("VPERMT2PS", ops...) } func (o Opcodes) VPERMT2PS(ops ...Operand) { o.a.op("VPERMT2PS", ops...) } func (o Opcodes) Vpermt2q(ops ...Operand) { o.a.op("VPERMT2Q", ops...) } func (o Opcodes) VPERMT2Q(ops ...Operand) { o.a.op("VPERMT2Q", ops...) } func (o Opcodes) Vpermt2w(ops ...Operand) { o.a.op("VPERMT2W", ops...) } func (o Opcodes) VPERMT2W(ops ...Operand) { o.a.op("VPERMT2W", ops...) } func (o Opcodes) Vpermw(ops ...Operand) { o.a.op("VPERMW", ops...) } func (o Opcodes) VPERMW(ops ...Operand) { o.a.op("VPERMW", ops...) } func (o Opcodes) Vpexpandb(ops ...Operand) { o.a.op("VPEXPANDB", ops...) } func (o Opcodes) VPEXPANDB(ops ...Operand) { o.a.op("VPEXPANDB", ops...) } func (o Opcodes) Vpexpandd(ops ...Operand) { o.a.op("VPEXPANDD", ops...) } func (o Opcodes) VPEXPANDD(ops ...Operand) { o.a.op("VPEXPANDD", ops...) } func (o Opcodes) Vpexpandq(ops ...Operand) { o.a.op("VPEXPANDQ", ops...) } func (o Opcodes) VPEXPANDQ(ops ...Operand) { o.a.op("VPEXPANDQ", ops...) } func (o Opcodes) Vpexpandw(ops ...Operand) { o.a.op("VPEXPANDW", ops...) } func (o Opcodes) VPEXPANDW(ops ...Operand) { o.a.op("VPEXPANDW", ops...) } func (o Opcodes) Vpextrb(ops ...Operand) { o.a.op("VPEXTRB", ops...) } func (o Opcodes) VPEXTRB(ops ...Operand) { o.a.op("VPEXTRB", ops...) } func (o Opcodes) Vpextrd(ops ...Operand) { o.a.op("VPEXTRD", ops...) } func (o Opcodes) VPEXTRD(ops ...Operand) { o.a.op("VPEXTRD", ops...) } func (o Opcodes) Vpextrq(ops ...Operand) { o.a.op("VPEXTRQ", ops...) } func (o Opcodes) VPEXTRQ(ops ...Operand) { o.a.op("VPEXTRQ", ops...) } func (o Opcodes) Vpextrw(ops ...Operand) { o.a.op("VPEXTRW", ops...) } func (o Opcodes) VPEXTRW(ops ...Operand) { o.a.op("VPEXTRW", ops...) } func (o Opcodes) Vpgatherdd(ops ...Operand) { o.a.op("VPGATHERDD", ops...) } func (o Opcodes) VPGATHERDD(ops ...Operand) { o.a.op("VPGATHERDD", ops...) } func (o Opcodes) Vpgatherdq(ops ...Operand) { o.a.op("VPGATHERDQ", ops...) } func (o Opcodes) VPGATHERDQ(ops ...Operand) { o.a.op("VPGATHERDQ", ops...) } func (o Opcodes) Vpgatherqd(ops ...Operand) { o.a.op("VPGATHERQD", ops...) } func (o Opcodes) VPGATHERQD(ops ...Operand) { o.a.op("VPGATHERQD", ops...) } func (o Opcodes) Vpgatherqq(ops ...Operand) { o.a.op("VPGATHERQQ", ops...) } func (o Opcodes) VPGATHERQQ(ops ...Operand) { o.a.op("VPGATHERQQ", ops...) } func (o Opcodes) Vphaddd(ops ...Operand) { o.a.op("VPHADDD", ops...) } func (o Opcodes) VPHADDD(ops ...Operand) { o.a.op("VPHADDD", ops...) } func (o Opcodes) Vphaddsw(ops ...Operand) { o.a.op("VPHADDSW", ops...) } func (o Opcodes) VPHADDSW(ops ...Operand) { o.a.op("VPHADDSW", ops...) } func (o Opcodes) Vphaddw(ops ...Operand) { o.a.op("VPHADDW", ops...) } func (o Opcodes) VPHADDW(ops ...Operand) { o.a.op("VPHADDW", ops...) } func (o Opcodes) Vphminposuw(ops ...Operand) { o.a.op("VPHMINPOSUW", ops...) } func (o Opcodes) VPHMINPOSUW(ops ...Operand) { o.a.op("VPHMINPOSUW", ops...) } func (o Opcodes) Vphsubd(ops ...Operand) { o.a.op("VPHSUBD", ops...) } func (o Opcodes) VPHSUBD(ops ...Operand) { o.a.op("VPHSUBD", ops...) } func (o Opcodes) Vphsubsw(ops ...Operand) { o.a.op("VPHSUBSW", ops...) } func (o Opcodes) VPHSUBSW(ops ...Operand) { o.a.op("VPHSUBSW", ops...) } func (o Opcodes) Vphsubw(ops ...Operand) { o.a.op("VPHSUBW", ops...) } func (o Opcodes) VPHSUBW(ops ...Operand) { o.a.op("VPHSUBW", ops...) } func (o Opcodes) Vpinsrb(ops ...Operand) { o.a.op("VPINSRB", ops...) } func (o Opcodes) VPINSRB(ops ...Operand) { o.a.op("VPINSRB", ops...) } func (o Opcodes) Vpinsrd(ops ...Operand) { o.a.op("VPINSRD", ops...) } func (o Opcodes) VPINSRD(ops ...Operand) { o.a.op("VPINSRD", ops...) } func (o Opcodes) Vpinsrq(ops ...Operand) { o.a.op("VPINSRQ", ops...) } func (o Opcodes) VPINSRQ(ops ...Operand) { o.a.op("VPINSRQ", ops...) } func (o Opcodes) Vpinsrw(ops ...Operand) { o.a.op("VPINSRW", ops...) } func (o Opcodes) VPINSRW(ops ...Operand) { o.a.op("VPINSRW", ops...) } func (o Opcodes) Vplzcntd(ops ...Operand) { o.a.op("VPLZCNTD", ops...) } func (o Opcodes) VPLZCNTD(ops ...Operand) { o.a.op("VPLZCNTD", ops...) } func (o Opcodes) Vplzcntq(ops ...Operand) { o.a.op("VPLZCNTQ", ops...) } func (o Opcodes) VPLZCNTQ(ops ...Operand) { o.a.op("VPLZCNTQ", ops...) } func (o Opcodes) Vpmadd52huq(ops ...Operand) { o.a.op("VPMADD52HUQ", ops...) } func (o Opcodes) VPMADD52HUQ(ops ...Operand) { o.a.op("VPMADD52HUQ", ops...) } func (o Opcodes) Vpmadd52luq(ops ...Operand) { o.a.op("VPMADD52LUQ", ops...) } func (o Opcodes) VPMADD52LUQ(ops ...Operand) { o.a.op("VPMADD52LUQ", ops...) } func (o Opcodes) Vpmaddubsw(ops ...Operand) { o.a.op("VPMADDUBSW", ops...) } func (o Opcodes) VPMADDUBSW(ops ...Operand) { o.a.op("VPMADDUBSW", ops...) } func (o Opcodes) Vpmaddwd(ops ...Operand) { o.a.op("VPMADDWD", ops...) } func (o Opcodes) VPMADDWD(ops ...Operand) { o.a.op("VPMADDWD", ops...) } func (o Opcodes) Vpmaskmovd(ops ...Operand) { o.a.op("VPMASKMOVD", ops...) } func (o Opcodes) VPMASKMOVD(ops ...Operand) { o.a.op("VPMASKMOVD", ops...) } func (o Opcodes) Vpmaskmovq(ops ...Operand) { o.a.op("VPMASKMOVQ", ops...) } func (o Opcodes) VPMASKMOVQ(ops ...Operand) { o.a.op("VPMASKMOVQ", ops...) } func (o Opcodes) Vpmaxsb(ops ...Operand) { o.a.op("VPMAXSB", ops...) } func (o Opcodes) VPMAXSB(ops ...Operand) { o.a.op("VPMAXSB", ops...) } func (o Opcodes) Vpmaxsd(ops ...Operand) { o.a.op("VPMAXSD", ops...) } func (o Opcodes) VPMAXSD(ops ...Operand) { o.a.op("VPMAXSD", ops...) } func (o Opcodes) Vpmaxsq(ops ...Operand) { o.a.op("VPMAXSQ", ops...) } func (o Opcodes) VPMAXSQ(ops ...Operand) { o.a.op("VPMAXSQ", ops...) } func (o Opcodes) Vpmaxsw(ops ...Operand) { o.a.op("VPMAXSW", ops...) } func (o Opcodes) VPMAXSW(ops ...Operand) { o.a.op("VPMAXSW", ops...) } func (o Opcodes) Vpmaxub(ops ...Operand) { o.a.op("VPMAXUB", ops...) } func (o Opcodes) VPMAXUB(ops ...Operand) { o.a.op("VPMAXUB", ops...) } func (o Opcodes) Vpmaxud(ops ...Operand) { o.a.op("VPMAXUD", ops...) } func (o Opcodes) VPMAXUD(ops ...Operand) { o.a.op("VPMAXUD", ops...) } func (o Opcodes) Vpmaxuq(ops ...Operand) { o.a.op("VPMAXUQ", ops...) } func (o Opcodes) VPMAXUQ(ops ...Operand) { o.a.op("VPMAXUQ", ops...) } func (o Opcodes) Vpmaxuw(ops ...Operand) { o.a.op("VPMAXUW", ops...) } func (o Opcodes) VPMAXUW(ops ...Operand) { o.a.op("VPMAXUW", ops...) } func (o Opcodes) Vpminsb(ops ...Operand) { o.a.op("VPMINSB", ops...) } func (o Opcodes) VPMINSB(ops ...Operand) { o.a.op("VPMINSB", ops...) } func (o Opcodes) Vpminsd(ops ...Operand) { o.a.op("VPMINSD", ops...) } func (o Opcodes) VPMINSD(ops ...Operand) { o.a.op("VPMINSD", ops...) } func (o Opcodes) Vpminsq(ops ...Operand) { o.a.op("VPMINSQ", ops...) } func (o Opcodes) VPMINSQ(ops ...Operand) { o.a.op("VPMINSQ", ops...) } func (o Opcodes) Vpminsw(ops ...Operand) { o.a.op("VPMINSW", ops...) } func (o Opcodes) VPMINSW(ops ...Operand) { o.a.op("VPMINSW", ops...) } func (o Opcodes) Vpminub(ops ...Operand) { o.a.op("VPMINUB", ops...) } func (o Opcodes) VPMINUB(ops ...Operand) { o.a.op("VPMINUB", ops...) } func (o Opcodes) Vpminud(ops ...Operand) { o.a.op("VPMINUD", ops...) } func (o Opcodes) VPMINUD(ops ...Operand) { o.a.op("VPMINUD", ops...) } func (o Opcodes) Vpminuq(ops ...Operand) { o.a.op("VPMINUQ", ops...) } func (o Opcodes) VPMINUQ(ops ...Operand) { o.a.op("VPMINUQ", ops...) } func (o Opcodes) Vpminuw(ops ...Operand) { o.a.op("VPMINUW", ops...) } func (o Opcodes) VPMINUW(ops ...Operand) { o.a.op("VPMINUW", ops...) } func (o Opcodes) Vpmovb2m(ops ...Operand) { o.a.op("VPMOVB2M", ops...) } func (o Opcodes) VPMOVB2M(ops ...Operand) { o.a.op("VPMOVB2M", ops...) } func (o Opcodes) Vpmovd2m(ops ...Operand) { o.a.op("VPMOVD2M", ops...) } func (o Opcodes) VPMOVD2M(ops ...Operand) { o.a.op("VPMOVD2M", ops...) } func (o Opcodes) Vpmovdb(ops ...Operand) { o.a.op("VPMOVDB", ops...) } func (o Opcodes) VPMOVDB(ops ...Operand) { o.a.op("VPMOVDB", ops...) } func (o Opcodes) Vpmovdw(ops ...Operand) { o.a.op("VPMOVDW", ops...) } func (o Opcodes) VPMOVDW(ops ...Operand) { o.a.op("VPMOVDW", ops...) } func (o Opcodes) Vpmovm2b(ops ...Operand) { o.a.op("VPMOVM2B", ops...) } func (o Opcodes) VPMOVM2B(ops ...Operand) { o.a.op("VPMOVM2B", ops...) } func (o Opcodes) Vpmovm2d(ops ...Operand) { o.a.op("VPMOVM2D", ops...) } func (o Opcodes) VPMOVM2D(ops ...Operand) { o.a.op("VPMOVM2D", ops...) } func (o Opcodes) Vpmovm2q(ops ...Operand) { o.a.op("VPMOVM2Q", ops...) } func (o Opcodes) VPMOVM2Q(ops ...Operand) { o.a.op("VPMOVM2Q", ops...) } func (o Opcodes) Vpmovm2w(ops ...Operand) { o.a.op("VPMOVM2W", ops...) } func (o Opcodes) VPMOVM2W(ops ...Operand) { o.a.op("VPMOVM2W", ops...) } func (o Opcodes) Vpmovmskb(ops ...Operand) { o.a.op("VPMOVMSKB", ops...) } func (o Opcodes) VPMOVMSKB(ops ...Operand) { o.a.op("VPMOVMSKB", ops...) } func (o Opcodes) Vpmovq2m(ops ...Operand) { o.a.op("VPMOVQ2M", ops...) } func (o Opcodes) VPMOVQ2M(ops ...Operand) { o.a.op("VPMOVQ2M", ops...) } func (o Opcodes) Vpmovqb(ops ...Operand) { o.a.op("VPMOVQB", ops...) } func (o Opcodes) VPMOVQB(ops ...Operand) { o.a.op("VPMOVQB", ops...) } func (o Opcodes) Vpmovqd(ops ...Operand) { o.a.op("VPMOVQD", ops...) } func (o Opcodes) VPMOVQD(ops ...Operand) { o.a.op("VPMOVQD", ops...) } func (o Opcodes) Vpmovqw(ops ...Operand) { o.a.op("VPMOVQW", ops...) } func (o Opcodes) VPMOVQW(ops ...Operand) { o.a.op("VPMOVQW", ops...) } func (o Opcodes) Vpmovsdb(ops ...Operand) { o.a.op("VPMOVSDB", ops...) } func (o Opcodes) VPMOVSDB(ops ...Operand) { o.a.op("VPMOVSDB", ops...) } func (o Opcodes) Vpmovsdw(ops ...Operand) { o.a.op("VPMOVSDW", ops...) } func (o Opcodes) VPMOVSDW(ops ...Operand) { o.a.op("VPMOVSDW", ops...) } func (o Opcodes) Vpmovsqb(ops ...Operand) { o.a.op("VPMOVSQB", ops...) } func (o Opcodes) VPMOVSQB(ops ...Operand) { o.a.op("VPMOVSQB", ops...) } func (o Opcodes) Vpmovsqd(ops ...Operand) { o.a.op("VPMOVSQD", ops...) } func (o Opcodes) VPMOVSQD(ops ...Operand) { o.a.op("VPMOVSQD", ops...) } func (o Opcodes) Vpmovsqw(ops ...Operand) { o.a.op("VPMOVSQW", ops...) } func (o Opcodes) VPMOVSQW(ops ...Operand) { o.a.op("VPMOVSQW", ops...) } func (o Opcodes) Vpmovswb(ops ...Operand) { o.a.op("VPMOVSWB", ops...) } func (o Opcodes) VPMOVSWB(ops ...Operand) { o.a.op("VPMOVSWB", ops...) } func (o Opcodes) Vpmovsxbd(ops ...Operand) { o.a.op("VPMOVSXBD", ops...) } func (o Opcodes) VPMOVSXBD(ops ...Operand) { o.a.op("VPMOVSXBD", ops...) } func (o Opcodes) Vpmovsxbq(ops ...Operand) { o.a.op("VPMOVSXBQ", ops...) } func (o Opcodes) VPMOVSXBQ(ops ...Operand) { o.a.op("VPMOVSXBQ", ops...) } func (o Opcodes) Vpmovsxbw(ops ...Operand) { o.a.op("VPMOVSXBW", ops...) } func (o Opcodes) VPMOVSXBW(ops ...Operand) { o.a.op("VPMOVSXBW", ops...) } func (o Opcodes) Vpmovsxdq(ops ...Operand) { o.a.op("VPMOVSXDQ", ops...) } func (o Opcodes) VPMOVSXDQ(ops ...Operand) { o.a.op("VPMOVSXDQ", ops...) } func (o Opcodes) Vpmovsxwd(ops ...Operand) { o.a.op("VPMOVSXWD", ops...) } func (o Opcodes) VPMOVSXWD(ops ...Operand) { o.a.op("VPMOVSXWD", ops...) } func (o Opcodes) Vpmovsxwq(ops ...Operand) { o.a.op("VPMOVSXWQ", ops...) } func (o Opcodes) VPMOVSXWQ(ops ...Operand) { o.a.op("VPMOVSXWQ", ops...) } func (o Opcodes) Vpmovusdb(ops ...Operand) { o.a.op("VPMOVUSDB", ops...) } func (o Opcodes) VPMOVUSDB(ops ...Operand) { o.a.op("VPMOVUSDB", ops...) } func (o Opcodes) Vpmovusdw(ops ...Operand) { o.a.op("VPMOVUSDW", ops...) } func (o Opcodes) VPMOVUSDW(ops ...Operand) { o.a.op("VPMOVUSDW", ops...) } func (o Opcodes) Vpmovusqb(ops ...Operand) { o.a.op("VPMOVUSQB", ops...) } func (o Opcodes) VPMOVUSQB(ops ...Operand) { o.a.op("VPMOVUSQB", ops...) } func (o Opcodes) Vpmovusqd(ops ...Operand) { o.a.op("VPMOVUSQD", ops...) } func (o Opcodes) VPMOVUSQD(ops ...Operand) { o.a.op("VPMOVUSQD", ops...) } func (o Opcodes) Vpmovusqw(ops ...Operand) { o.a.op("VPMOVUSQW", ops...) } func (o Opcodes) VPMOVUSQW(ops ...Operand) { o.a.op("VPMOVUSQW", ops...) } func (o Opcodes) Vpmovuswb(ops ...Operand) { o.a.op("VPMOVUSWB", ops...) } func (o Opcodes) VPMOVUSWB(ops ...Operand) { o.a.op("VPMOVUSWB", ops...) } func (o Opcodes) Vpmovw2m(ops ...Operand) { o.a.op("VPMOVW2M", ops...) } func (o Opcodes) VPMOVW2M(ops ...Operand) { o.a.op("VPMOVW2M", ops...) } func (o Opcodes) Vpmovwb(ops ...Operand) { o.a.op("VPMOVWB", ops...) } func (o Opcodes) VPMOVWB(ops ...Operand) { o.a.op("VPMOVWB", ops...) } func (o Opcodes) Vpmovzxbd(ops ...Operand) { o.a.op("VPMOVZXBD", ops...) } func (o Opcodes) VPMOVZXBD(ops ...Operand) { o.a.op("VPMOVZXBD", ops...) } func (o Opcodes) Vpmovzxbq(ops ...Operand) { o.a.op("VPMOVZXBQ", ops...) } func (o Opcodes) VPMOVZXBQ(ops ...Operand) { o.a.op("VPMOVZXBQ", ops...) } func (o Opcodes) Vpmovzxbw(ops ...Operand) { o.a.op("VPMOVZXBW", ops...) } func (o Opcodes) VPMOVZXBW(ops ...Operand) { o.a.op("VPMOVZXBW", ops...) } func (o Opcodes) Vpmovzxdq(ops ...Operand) { o.a.op("VPMOVZXDQ", ops...) } func (o Opcodes) VPMOVZXDQ(ops ...Operand) { o.a.op("VPMOVZXDQ", ops...) } func (o Opcodes) Vpmovzxwd(ops ...Operand) { o.a.op("VPMOVZXWD", ops...) } func (o Opcodes) VPMOVZXWD(ops ...Operand) { o.a.op("VPMOVZXWD", ops...) } func (o Opcodes) Vpmovzxwq(ops ...Operand) { o.a.op("VPMOVZXWQ", ops...) } func (o Opcodes) VPMOVZXWQ(ops ...Operand) { o.a.op("VPMOVZXWQ", ops...) } func (o Opcodes) Vpmuldq(ops ...Operand) { o.a.op("VPMULDQ", ops...) } func (o Opcodes) VPMULDQ(ops ...Operand) { o.a.op("VPMULDQ", ops...) } func (o Opcodes) Vpmulhrsw(ops ...Operand) { o.a.op("VPMULHRSW", ops...) } func (o Opcodes) VPMULHRSW(ops ...Operand) { o.a.op("VPMULHRSW", ops...) } func (o Opcodes) Vpmulhuw(ops ...Operand) { o.a.op("VPMULHUW", ops...) } func (o Opcodes) VPMULHUW(ops ...Operand) { o.a.op("VPMULHUW", ops...) } func (o Opcodes) Vpmulhw(ops ...Operand) { o.a.op("VPMULHW", ops...) } func (o Opcodes) VPMULHW(ops ...Operand) { o.a.op("VPMULHW", ops...) } func (o Opcodes) Vpmulld(ops ...Operand) { o.a.op("VPMULLD", ops...) } func (o Opcodes) VPMULLD(ops ...Operand) { o.a.op("VPMULLD", ops...) } func (o Opcodes) Vpmullq(ops ...Operand) { o.a.op("VPMULLQ", ops...) } func (o Opcodes) VPMULLQ(ops ...Operand) { o.a.op("VPMULLQ", ops...) } func (o Opcodes) Vpmullw(ops ...Operand) { o.a.op("VPMULLW", ops...) } func (o Opcodes) VPMULLW(ops ...Operand) { o.a.op("VPMULLW", ops...) } func (o Opcodes) Vpmultishiftqb(ops ...Operand) { o.a.op("VPMULTISHIFTQB", ops...) } func (o Opcodes) VPMULTISHIFTQB(ops ...Operand) { o.a.op("VPMULTISHIFTQB", ops...) } func (o Opcodes) Vpmuludq(ops ...Operand) { o.a.op("VPMULUDQ", ops...) } func (o Opcodes) VPMULUDQ(ops ...Operand) { o.a.op("VPMULUDQ", ops...) } func (o Opcodes) Vpopcntb(ops ...Operand) { o.a.op("VPOPCNTB", ops...) } func (o Opcodes) VPOPCNTB(ops ...Operand) { o.a.op("VPOPCNTB", ops...) } func (o Opcodes) Vpopcntd(ops ...Operand) { o.a.op("VPOPCNTD", ops...) } func (o Opcodes) VPOPCNTD(ops ...Operand) { o.a.op("VPOPCNTD", ops...) } func (o Opcodes) Vpopcntq(ops ...Operand) { o.a.op("VPOPCNTQ", ops...) } func (o Opcodes) VPOPCNTQ(ops ...Operand) { o.a.op("VPOPCNTQ", ops...) } func (o Opcodes) Vpopcntw(ops ...Operand) { o.a.op("VPOPCNTW", ops...) } func (o Opcodes) VPOPCNTW(ops ...Operand) { o.a.op("VPOPCNTW", ops...) } func (o Opcodes) Vpor(ops ...Operand) { o.a.op("VPOR", ops...) } func (o Opcodes) VPOR(ops ...Operand) { o.a.op("VPOR", ops...) } func (o Opcodes) Vpord(ops ...Operand) { o.a.op("VPORD", ops...) } func (o Opcodes) VPORD(ops ...Operand) { o.a.op("VPORD", ops...) } func (o Opcodes) Vporq(ops ...Operand) { o.a.op("VPORQ", ops...) } func (o Opcodes) VPORQ(ops ...Operand) { o.a.op("VPORQ", ops...) } func (o Opcodes) Vprold(ops ...Operand) { o.a.op("VPROLD", ops...) } func (o Opcodes) VPROLD(ops ...Operand) { o.a.op("VPROLD", ops...) } func (o Opcodes) Vprolq(ops ...Operand) { o.a.op("VPROLQ", ops...) } func (o Opcodes) VPROLQ(ops ...Operand) { o.a.op("VPROLQ", ops...) } func (o Opcodes) Vprolvd(ops ...Operand) { o.a.op("VPROLVD", ops...) } func (o Opcodes) VPROLVD(ops ...Operand) { o.a.op("VPROLVD", ops...) } func (o Opcodes) Vprolvq(ops ...Operand) { o.a.op("VPROLVQ", ops...) } func (o Opcodes) VPROLVQ(ops ...Operand) { o.a.op("VPROLVQ", ops...) } func (o Opcodes) Vprord(ops ...Operand) { o.a.op("VPRORD", ops...) } func (o Opcodes) VPRORD(ops ...Operand) { o.a.op("VPRORD", ops...) } func (o Opcodes) Vprorq(ops ...Operand) { o.a.op("VPRORQ", ops...) } func (o Opcodes) VPRORQ(ops ...Operand) { o.a.op("VPRORQ", ops...) } func (o Opcodes) Vprorvd(ops ...Operand) { o.a.op("VPRORVD", ops...) } func (o Opcodes) VPRORVD(ops ...Operand) { o.a.op("VPRORVD", ops...) } func (o Opcodes) Vprorvq(ops ...Operand) { o.a.op("VPRORVQ", ops...) } func (o Opcodes) VPRORVQ(ops ...Operand) { o.a.op("VPRORVQ", ops...) } func (o Opcodes) Vpsadbw(ops ...Operand) { o.a.op("VPSADBW", ops...) } func (o Opcodes) VPSADBW(ops ...Operand) { o.a.op("VPSADBW", ops...) } func (o Opcodes) Vpscatterdd(ops ...Operand) { o.a.op("VPSCATTERDD", ops...) } func (o Opcodes) VPSCATTERDD(ops ...Operand) { o.a.op("VPSCATTERDD", ops...) } func (o Opcodes) Vpscatterdq(ops ...Operand) { o.a.op("VPSCATTERDQ", ops...) } func (o Opcodes) VPSCATTERDQ(ops ...Operand) { o.a.op("VPSCATTERDQ", ops...) } func (o Opcodes) Vpscatterqd(ops ...Operand) { o.a.op("VPSCATTERQD", ops...) } func (o Opcodes) VPSCATTERQD(ops ...Operand) { o.a.op("VPSCATTERQD", ops...) } func (o Opcodes) Vpscatterqq(ops ...Operand) { o.a.op("VPSCATTERQQ", ops...) } func (o Opcodes) VPSCATTERQQ(ops ...Operand) { o.a.op("VPSCATTERQQ", ops...) } func (o Opcodes) Vpshldd(ops ...Operand) { o.a.op("VPSHLDD", ops...) } func (o Opcodes) VPSHLDD(ops ...Operand) { o.a.op("VPSHLDD", ops...) } func (o Opcodes) Vpshldq(ops ...Operand) { o.a.op("VPSHLDQ", ops...) } func (o Opcodes) VPSHLDQ(ops ...Operand) { o.a.op("VPSHLDQ", ops...) } func (o Opcodes) Vpshldvd(ops ...Operand) { o.a.op("VPSHLDVD", ops...) } func (o Opcodes) VPSHLDVD(ops ...Operand) { o.a.op("VPSHLDVD", ops...) } func (o Opcodes) Vpshldvq(ops ...Operand) { o.a.op("VPSHLDVQ", ops...) } func (o Opcodes) VPSHLDVQ(ops ...Operand) { o.a.op("VPSHLDVQ", ops...) } func (o Opcodes) Vpshldvw(ops ...Operand) { o.a.op("VPSHLDVW", ops...) } func (o Opcodes) VPSHLDVW(ops ...Operand) { o.a.op("VPSHLDVW", ops...) } func (o Opcodes) Vpshldw(ops ...Operand) { o.a.op("VPSHLDW", ops...) } func (o Opcodes) VPSHLDW(ops ...Operand) { o.a.op("VPSHLDW", ops...) } func (o Opcodes) Vpshrdd(ops ...Operand) { o.a.op("VPSHRDD", ops...) } func (o Opcodes) VPSHRDD(ops ...Operand) { o.a.op("VPSHRDD", ops...) } func (o Opcodes) Vpshrdq(ops ...Operand) { o.a.op("VPSHRDQ", ops...) } func (o Opcodes) VPSHRDQ(ops ...Operand) { o.a.op("VPSHRDQ", ops...) } func (o Opcodes) Vpshrdvd(ops ...Operand) { o.a.op("VPSHRDVD", ops...) } func (o Opcodes) VPSHRDVD(ops ...Operand) { o.a.op("VPSHRDVD", ops...) } func (o Opcodes) Vpshrdvq(ops ...Operand) { o.a.op("VPSHRDVQ", ops...) } func (o Opcodes) VPSHRDVQ(ops ...Operand) { o.a.op("VPSHRDVQ", ops...) } func (o Opcodes) Vpshrdvw(ops ...Operand) { o.a.op("VPSHRDVW", ops...) } func (o Opcodes) VPSHRDVW(ops ...Operand) { o.a.op("VPSHRDVW", ops...) } func (o Opcodes) Vpshrdw(ops ...Operand) { o.a.op("VPSHRDW", ops...) } func (o Opcodes) VPSHRDW(ops ...Operand) { o.a.op("VPSHRDW", ops...) } func (o Opcodes) Vpshufb(ops ...Operand) { o.a.op("VPSHUFB", ops...) } func (o Opcodes) VPSHUFB(ops ...Operand) { o.a.op("VPSHUFB", ops...) } func (o Opcodes) Vpshufbitqmb(ops ...Operand) { o.a.op("VPSHUFBITQMB", ops...) } func (o Opcodes) VPSHUFBITQMB(ops ...Operand) { o.a.op("VPSHUFBITQMB", ops...) } func (o Opcodes) Vpshufd(ops ...Operand) { o.a.op("VPSHUFD", ops...) } func (o Opcodes) VPSHUFD(ops ...Operand) { o.a.op("VPSHUFD", ops...) } func (o Opcodes) Vpshufhw(ops ...Operand) { o.a.op("VPSHUFHW", ops...) } func (o Opcodes) VPSHUFHW(ops ...Operand) { o.a.op("VPSHUFHW", ops...) } func (o Opcodes) Vpshuflw(ops ...Operand) { o.a.op("VPSHUFLW", ops...) } func (o Opcodes) VPSHUFLW(ops ...Operand) { o.a.op("VPSHUFLW", ops...) } func (o Opcodes) Vpsignb(ops ...Operand) { o.a.op("VPSIGNB", ops...) } func (o Opcodes) VPSIGNB(ops ...Operand) { o.a.op("VPSIGNB", ops...) } func (o Opcodes) Vpsignd(ops ...Operand) { o.a.op("VPSIGND", ops...) } func (o Opcodes) VPSIGND(ops ...Operand) { o.a.op("VPSIGND", ops...) } func (o Opcodes) Vpsignw(ops ...Operand) { o.a.op("VPSIGNW", ops...) } func (o Opcodes) VPSIGNW(ops ...Operand) { o.a.op("VPSIGNW", ops...) } func (o Opcodes) Vpslld(ops ...Operand) { o.a.op("VPSLLD", ops...) } func (o Opcodes) VPSLLD(ops ...Operand) { o.a.op("VPSLLD", ops...) } func (o Opcodes) Vpslldq(ops ...Operand) { o.a.op("VPSLLDQ", ops...) } func (o Opcodes) VPSLLDQ(ops ...Operand) { o.a.op("VPSLLDQ", ops...) } func (o Opcodes) Vpsllq(ops ...Operand) { o.a.op("VPSLLQ", ops...) } func (o Opcodes) VPSLLQ(ops ...Operand) { o.a.op("VPSLLQ", ops...) } func (o Opcodes) Vpsllvd(ops ...Operand) { o.a.op("VPSLLVD", ops...) } func (o Opcodes) VPSLLVD(ops ...Operand) { o.a.op("VPSLLVD", ops...) } func (o Opcodes) Vpsllvq(ops ...Operand) { o.a.op("VPSLLVQ", ops...) } func (o Opcodes) VPSLLVQ(ops ...Operand) { o.a.op("VPSLLVQ", ops...) } func (o Opcodes) Vpsllvw(ops ...Operand) { o.a.op("VPSLLVW", ops...) } func (o Opcodes) VPSLLVW(ops ...Operand) { o.a.op("VPSLLVW", ops...) } func (o Opcodes) Vpsllw(ops ...Operand) { o.a.op("VPSLLW", ops...) } func (o Opcodes) VPSLLW(ops ...Operand) { o.a.op("VPSLLW", ops...) } func (o Opcodes) Vpsrad(ops ...Operand) { o.a.op("VPSRAD", ops...) } func (o Opcodes) VPSRAD(ops ...Operand) { o.a.op("VPSRAD", ops...) } func (o Opcodes) Vpsraq(ops ...Operand) { o.a.op("VPSRAQ", ops...) } func (o Opcodes) VPSRAQ(ops ...Operand) { o.a.op("VPSRAQ", ops...) } func (o Opcodes) Vpsravd(ops ...Operand) { o.a.op("VPSRAVD", ops...) } func (o Opcodes) VPSRAVD(ops ...Operand) { o.a.op("VPSRAVD", ops...) } func (o Opcodes) Vpsravq(ops ...Operand) { o.a.op("VPSRAVQ", ops...) } func (o Opcodes) VPSRAVQ(ops ...Operand) { o.a.op("VPSRAVQ", ops...) } func (o Opcodes) Vpsravw(ops ...Operand) { o.a.op("VPSRAVW", ops...) } func (o Opcodes) VPSRAVW(ops ...Operand) { o.a.op("VPSRAVW", ops...) } func (o Opcodes) Vpsraw(ops ...Operand) { o.a.op("VPSRAW", ops...) } func (o Opcodes) VPSRAW(ops ...Operand) { o.a.op("VPSRAW", ops...) } func (o Opcodes) Vpsrld(ops ...Operand) { o.a.op("VPSRLD", ops...) } func (o Opcodes) VPSRLD(ops ...Operand) { o.a.op("VPSRLD", ops...) } func (o Opcodes) Vpsrldq(ops ...Operand) { o.a.op("VPSRLDQ", ops...) } func (o Opcodes) VPSRLDQ(ops ...Operand) { o.a.op("VPSRLDQ", ops...) } func (o Opcodes) Vpsrlq(ops ...Operand) { o.a.op("VPSRLQ", ops...) } func (o Opcodes) VPSRLQ(ops ...Operand) { o.a.op("VPSRLQ", ops...) } func (o Opcodes) Vpsrlvd(ops ...Operand) { o.a.op("VPSRLVD", ops...) } func (o Opcodes) VPSRLVD(ops ...Operand) { o.a.op("VPSRLVD", ops...) } func (o Opcodes) Vpsrlvq(ops ...Operand) { o.a.op("VPSRLVQ", ops...) } func (o Opcodes) VPSRLVQ(ops ...Operand) { o.a.op("VPSRLVQ", ops...) } func (o Opcodes) Vpsrlvw(ops ...Operand) { o.a.op("VPSRLVW", ops...) } func (o Opcodes) VPSRLVW(ops ...Operand) { o.a.op("VPSRLVW", ops...) } func (o Opcodes) Vpsrlw(ops ...Operand) { o.a.op("VPSRLW", ops...) } func (o Opcodes) VPSRLW(ops ...Operand) { o.a.op("VPSRLW", ops...) } func (o Opcodes) Vpsubb(ops ...Operand) { o.a.op("VPSUBB", ops...) } func (o Opcodes) VPSUBB(ops ...Operand) { o.a.op("VPSUBB", ops...) } func (o Opcodes) Vpsubd(ops ...Operand) { o.a.op("VPSUBD", ops...) } func (o Opcodes) VPSUBD(ops ...Operand) { o.a.op("VPSUBD", ops...) } func (o Opcodes) Vpsubq(ops ...Operand) { o.a.op("VPSUBQ", ops...) } func (o Opcodes) VPSUBQ(ops ...Operand) { o.a.op("VPSUBQ", ops...) } func (o Opcodes) Vpsubsb(ops ...Operand) { o.a.op("VPSUBSB", ops...) } func (o Opcodes) VPSUBSB(ops ...Operand) { o.a.op("VPSUBSB", ops...) } func (o Opcodes) Vpsubsw(ops ...Operand) { o.a.op("VPSUBSW", ops...) } func (o Opcodes) VPSUBSW(ops ...Operand) { o.a.op("VPSUBSW", ops...) } func (o Opcodes) Vpsubusb(ops ...Operand) { o.a.op("VPSUBUSB", ops...) } func (o Opcodes) VPSUBUSB(ops ...Operand) { o.a.op("VPSUBUSB", ops...) } func (o Opcodes) Vpsubusw(ops ...Operand) { o.a.op("VPSUBUSW", ops...) } func (o Opcodes) VPSUBUSW(ops ...Operand) { o.a.op("VPSUBUSW", ops...) } func (o Opcodes) Vpsubw(ops ...Operand) { o.a.op("VPSUBW", ops...) } func (o Opcodes) VPSUBW(ops ...Operand) { o.a.op("VPSUBW", ops...) } func (o Opcodes) Vpternlogd(ops ...Operand) { o.a.op("VPTERNLOGD", ops...) } func (o Opcodes) VPTERNLOGD(ops ...Operand) { o.a.op("VPTERNLOGD", ops...) } func (o Opcodes) Vpternlogq(ops ...Operand) { o.a.op("VPTERNLOGQ", ops...) } func (o Opcodes) VPTERNLOGQ(ops ...Operand) { o.a.op("VPTERNLOGQ", ops...) } func (o Opcodes) Vptest(ops ...Operand) { o.a.op("VPTEST", ops...) } func (o Opcodes) VPTEST(ops ...Operand) { o.a.op("VPTEST", ops...) } func (o Opcodes) Vptestmb(ops ...Operand) { o.a.op("VPTESTMB", ops...) } func (o Opcodes) VPTESTMB(ops ...Operand) { o.a.op("VPTESTMB", ops...) } func (o Opcodes) Vptestmd(ops ...Operand) { o.a.op("VPTESTMD", ops...) } func (o Opcodes) VPTESTMD(ops ...Operand) { o.a.op("VPTESTMD", ops...) } func (o Opcodes) Vptestmq(ops ...Operand) { o.a.op("VPTESTMQ", ops...) } func (o Opcodes) VPTESTMQ(ops ...Operand) { o.a.op("VPTESTMQ", ops...) } func (o Opcodes) Vptestmw(ops ...Operand) { o.a.op("VPTESTMW", ops...) } func (o Opcodes) VPTESTMW(ops ...Operand) { o.a.op("VPTESTMW", ops...) } func (o Opcodes) Vptestnmb(ops ...Operand) { o.a.op("VPTESTNMB", ops...) } func (o Opcodes) VPTESTNMB(ops ...Operand) { o.a.op("VPTESTNMB", ops...) } func (o Opcodes) Vptestnmd(ops ...Operand) { o.a.op("VPTESTNMD", ops...) } func (o Opcodes) VPTESTNMD(ops ...Operand) { o.a.op("VPTESTNMD", ops...) } func (o Opcodes) Vptestnmq(ops ...Operand) { o.a.op("VPTESTNMQ", ops...) } func (o Opcodes) VPTESTNMQ(ops ...Operand) { o.a.op("VPTESTNMQ", ops...) } func (o Opcodes) Vptestnmw(ops ...Operand) { o.a.op("VPTESTNMW", ops...) } func (o Opcodes) VPTESTNMW(ops ...Operand) { o.a.op("VPTESTNMW", ops...) } func (o Opcodes) Vpunpckhbw(ops ...Operand) { o.a.op("VPUNPCKHBW", ops...) } func (o Opcodes) VPUNPCKHBW(ops ...Operand) { o.a.op("VPUNPCKHBW", ops...) } func (o Opcodes) Vpunpckhdq(ops ...Operand) { o.a.op("VPUNPCKHDQ", ops...) } func (o Opcodes) VPUNPCKHDQ(ops ...Operand) { o.a.op("VPUNPCKHDQ", ops...) } func (o Opcodes) Vpunpckhqdq(ops ...Operand) { o.a.op("VPUNPCKHQDQ", ops...) } func (o Opcodes) VPUNPCKHQDQ(ops ...Operand) { o.a.op("VPUNPCKHQDQ", ops...) } func (o Opcodes) Vpunpckhwd(ops ...Operand) { o.a.op("VPUNPCKHWD", ops...) } func (o Opcodes) VPUNPCKHWD(ops ...Operand) { o.a.op("VPUNPCKHWD", ops...) } func (o Opcodes) Vpunpcklbw(ops ...Operand) { o.a.op("VPUNPCKLBW", ops...) } func (o Opcodes) VPUNPCKLBW(ops ...Operand) { o.a.op("VPUNPCKLBW", ops...) } func (o Opcodes) Vpunpckldq(ops ...Operand) { o.a.op("VPUNPCKLDQ", ops...) } func (o Opcodes) VPUNPCKLDQ(ops ...Operand) { o.a.op("VPUNPCKLDQ", ops...) } func (o Opcodes) Vpunpcklqdq(ops ...Operand) { o.a.op("VPUNPCKLQDQ", ops...) } func (o Opcodes) VPUNPCKLQDQ(ops ...Operand) { o.a.op("VPUNPCKLQDQ", ops...) } func (o Opcodes) Vpunpcklwd(ops ...Operand) { o.a.op("VPUNPCKLWD", ops...) } func (o Opcodes) VPUNPCKLWD(ops ...Operand) { o.a.op("VPUNPCKLWD", ops...) } func (o Opcodes) Vpxor(ops ...Operand) { o.a.op("VPXOR", ops...) } func (o Opcodes) VPXOR(ops ...Operand) { o.a.op("VPXOR", ops...) } func (o Opcodes) Vpxord(ops ...Operand) { o.a.op("VPXORD", ops...) } func (o Opcodes) VPXORD(ops ...Operand) { o.a.op("VPXORD", ops...) } func (o Opcodes) Vpxorq(ops ...Operand) { o.a.op("VPXORQ", ops...) } func (o Opcodes) VPXORQ(ops ...Operand) { o.a.op("VPXORQ", ops...) } func (o Opcodes) Vrangepd(ops ...Operand) { o.a.op("VRANGEPD", ops...) } func (o Opcodes) VRANGEPD(ops ...Operand) { o.a.op("VRANGEPD", ops...) } func (o Opcodes) Vrangeps(ops ...Operand) { o.a.op("VRANGEPS", ops...) } func (o Opcodes) VRANGEPS(ops ...Operand) { o.a.op("VRANGEPS", ops...) } func (o Opcodes) Vrangesd(ops ...Operand) { o.a.op("VRANGESD", ops...) } func (o Opcodes) VRANGESD(ops ...Operand) { o.a.op("VRANGESD", ops...) } func (o Opcodes) Vrangess(ops ...Operand) { o.a.op("VRANGESS", ops...) } func (o Opcodes) VRANGESS(ops ...Operand) { o.a.op("VRANGESS", ops...) } func (o Opcodes) Vrcp14pd(ops ...Operand) { o.a.op("VRCP14PD", ops...) } func (o Opcodes) VRCP14PD(ops ...Operand) { o.a.op("VRCP14PD", ops...) } func (o Opcodes) Vrcp14ps(ops ...Operand) { o.a.op("VRCP14PS", ops...) } func (o Opcodes) VRCP14PS(ops ...Operand) { o.a.op("VRCP14PS", ops...) } func (o Opcodes) Vrcp14sd(ops ...Operand) { o.a.op("VRCP14SD", ops...) } func (o Opcodes) VRCP14SD(ops ...Operand) { o.a.op("VRCP14SD", ops...) } func (o Opcodes) Vrcp14ss(ops ...Operand) { o.a.op("VRCP14SS", ops...) } func (o Opcodes) VRCP14SS(ops ...Operand) { o.a.op("VRCP14SS", ops...) } func (o Opcodes) Vrcp28pd(ops ...Operand) { o.a.op("VRCP28PD", ops...) } func (o Opcodes) VRCP28PD(ops ...Operand) { o.a.op("VRCP28PD", ops...) } func (o Opcodes) Vrcp28ps(ops ...Operand) { o.a.op("VRCP28PS", ops...) } func (o Opcodes) VRCP28PS(ops ...Operand) { o.a.op("VRCP28PS", ops...) } func (o Opcodes) Vrcp28sd(ops ...Operand) { o.a.op("VRCP28SD", ops...) } func (o Opcodes) VRCP28SD(ops ...Operand) { o.a.op("VRCP28SD", ops...) } func (o Opcodes) Vrcp28ss(ops ...Operand) { o.a.op("VRCP28SS", ops...) } func (o Opcodes) VRCP28SS(ops ...Operand) { o.a.op("VRCP28SS", ops...) } func (o Opcodes) Vrcpps(ops ...Operand) { o.a.op("VRCPPS", ops...) } func (o Opcodes) VRCPPS(ops ...Operand) { o.a.op("VRCPPS", ops...) } func (o Opcodes) Vrcpss(ops ...Operand) { o.a.op("VRCPSS", ops...) } func (o Opcodes) VRCPSS(ops ...Operand) { o.a.op("VRCPSS", ops...) } func (o Opcodes) Vreducepd(ops ...Operand) { o.a.op("VREDUCEPD", ops...) } func (o Opcodes) VREDUCEPD(ops ...Operand) { o.a.op("VREDUCEPD", ops...) } func (o Opcodes) Vreduceps(ops ...Operand) { o.a.op("VREDUCEPS", ops...) } func (o Opcodes) VREDUCEPS(ops ...Operand) { o.a.op("VREDUCEPS", ops...) } func (o Opcodes) Vreducesd(ops ...Operand) { o.a.op("VREDUCESD", ops...) } func (o Opcodes) VREDUCESD(ops ...Operand) { o.a.op("VREDUCESD", ops...) } func (o Opcodes) Vreducess(ops ...Operand) { o.a.op("VREDUCESS", ops...) } func (o Opcodes) VREDUCESS(ops ...Operand) { o.a.op("VREDUCESS", ops...) } func (o Opcodes) Vrndscalepd(ops ...Operand) { o.a.op("VRNDSCALEPD", ops...) } func (o Opcodes) VRNDSCALEPD(ops ...Operand) { o.a.op("VRNDSCALEPD", ops...) } func (o Opcodes) Vrndscaleps(ops ...Operand) { o.a.op("VRNDSCALEPS", ops...) } func (o Opcodes) VRNDSCALEPS(ops ...Operand) { o.a.op("VRNDSCALEPS", ops...) } func (o Opcodes) Vrndscalesd(ops ...Operand) { o.a.op("VRNDSCALESD", ops...) } func (o Opcodes) VRNDSCALESD(ops ...Operand) { o.a.op("VRNDSCALESD", ops...) } func (o Opcodes) Vrndscaless(ops ...Operand) { o.a.op("VRNDSCALESS", ops...) } func (o Opcodes) VRNDSCALESS(ops ...Operand) { o.a.op("VRNDSCALESS", ops...) } func (o Opcodes) Vroundpd(ops ...Operand) { o.a.op("VROUNDPD", ops...) } func (o Opcodes) VROUNDPD(ops ...Operand) { o.a.op("VROUNDPD", ops...) } func (o Opcodes) Vroundps(ops ...Operand) { o.a.op("VROUNDPS", ops...) } func (o Opcodes) VROUNDPS(ops ...Operand) { o.a.op("VROUNDPS", ops...) } func (o Opcodes) Vroundsd(ops ...Operand) { o.a.op("VROUNDSD", ops...) } func (o Opcodes) VROUNDSD(ops ...Operand) { o.a.op("VROUNDSD", ops...) } func (o Opcodes) Vroundss(ops ...Operand) { o.a.op("VROUNDSS", ops...) } func (o Opcodes) VROUNDSS(ops ...Operand) { o.a.op("VROUNDSS", ops...) } func (o Opcodes) Vrsqrt14pd(ops ...Operand) { o.a.op("VRSQRT14PD", ops...) } func (o Opcodes) VRSQRT14PD(ops ...Operand) { o.a.op("VRSQRT14PD", ops...) } func (o Opcodes) Vrsqrt14ps(ops ...Operand) { o.a.op("VRSQRT14PS", ops...) } func (o Opcodes) VRSQRT14PS(ops ...Operand) { o.a.op("VRSQRT14PS", ops...) } func (o Opcodes) Vrsqrt14sd(ops ...Operand) { o.a.op("VRSQRT14SD", ops...) } func (o Opcodes) VRSQRT14SD(ops ...Operand) { o.a.op("VRSQRT14SD", ops...) } func (o Opcodes) Vrsqrt14ss(ops ...Operand) { o.a.op("VRSQRT14SS", ops...) } func (o Opcodes) VRSQRT14SS(ops ...Operand) { o.a.op("VRSQRT14SS", ops...) } func (o Opcodes) Vrsqrt28pd(ops ...Operand) { o.a.op("VRSQRT28PD", ops...) } func (o Opcodes) VRSQRT28PD(ops ...Operand) { o.a.op("VRSQRT28PD", ops...) } func (o Opcodes) Vrsqrt28ps(ops ...Operand) { o.a.op("VRSQRT28PS", ops...) } func (o Opcodes) VRSQRT28PS(ops ...Operand) { o.a.op("VRSQRT28PS", ops...) } func (o Opcodes) Vrsqrt28sd(ops ...Operand) { o.a.op("VRSQRT28SD", ops...) } func (o Opcodes) VRSQRT28SD(ops ...Operand) { o.a.op("VRSQRT28SD", ops...) } func (o Opcodes) Vrsqrt28ss(ops ...Operand) { o.a.op("VRSQRT28SS", ops...) } func (o Opcodes) VRSQRT28SS(ops ...Operand) { o.a.op("VRSQRT28SS", ops...) } func (o Opcodes) Vrsqrtps(ops ...Operand) { o.a.op("VRSQRTPS", ops...) } func (o Opcodes) VRSQRTPS(ops ...Operand) { o.a.op("VRSQRTPS", ops...) } func (o Opcodes) Vrsqrtss(ops ...Operand) { o.a.op("VRSQRTSS", ops...) } func (o Opcodes) VRSQRTSS(ops ...Operand) { o.a.op("VRSQRTSS", ops...) } func (o Opcodes) Vscalefpd(ops ...Operand) { o.a.op("VSCALEFPD", ops...) } func (o Opcodes) VSCALEFPD(ops ...Operand) { o.a.op("VSCALEFPD", ops...) } func (o Opcodes) Vscalefps(ops ...Operand) { o.a.op("VSCALEFPS", ops...) } func (o Opcodes) VSCALEFPS(ops ...Operand) { o.a.op("VSCALEFPS", ops...) } func (o Opcodes) Vscalefsd(ops ...Operand) { o.a.op("VSCALEFSD", ops...) } func (o Opcodes) VSCALEFSD(ops ...Operand) { o.a.op("VSCALEFSD", ops...) } func (o Opcodes) Vscalefss(ops ...Operand) { o.a.op("VSCALEFSS", ops...) } func (o Opcodes) VSCALEFSS(ops ...Operand) { o.a.op("VSCALEFSS", ops...) } func (o Opcodes) Vscatterdpd(ops ...Operand) { o.a.op("VSCATTERDPD", ops...) } func (o Opcodes) VSCATTERDPD(ops ...Operand) { o.a.op("VSCATTERDPD", ops...) } func (o Opcodes) Vscatterdps(ops ...Operand) { o.a.op("VSCATTERDPS", ops...) } func (o Opcodes) VSCATTERDPS(ops ...Operand) { o.a.op("VSCATTERDPS", ops...) } func (o Opcodes) Vscatterpf0dpd(ops ...Operand) { o.a.op("VSCATTERPF0DPD", ops...) } func (o Opcodes) VSCATTERPF0DPD(ops ...Operand) { o.a.op("VSCATTERPF0DPD", ops...) } func (o Opcodes) Vscatterpf0dps(ops ...Operand) { o.a.op("VSCATTERPF0DPS", ops...) } func (o Opcodes) VSCATTERPF0DPS(ops ...Operand) { o.a.op("VSCATTERPF0DPS", ops...) } func (o Opcodes) Vscatterpf0qpd(ops ...Operand) { o.a.op("VSCATTERPF0QPD", ops...) } func (o Opcodes) VSCATTERPF0QPD(ops ...Operand) { o.a.op("VSCATTERPF0QPD", ops...) } func (o Opcodes) Vscatterpf0qps(ops ...Operand) { o.a.op("VSCATTERPF0QPS", ops...) } func (o Opcodes) VSCATTERPF0QPS(ops ...Operand) { o.a.op("VSCATTERPF0QPS", ops...) } func (o Opcodes) Vscatterpf1dpd(ops ...Operand) { o.a.op("VSCATTERPF1DPD", ops...) } func (o Opcodes) VSCATTERPF1DPD(ops ...Operand) { o.a.op("VSCATTERPF1DPD", ops...) } func (o Opcodes) Vscatterpf1dps(ops ...Operand) { o.a.op("VSCATTERPF1DPS", ops...) } func (o Opcodes) VSCATTERPF1DPS(ops ...Operand) { o.a.op("VSCATTERPF1DPS", ops...) } func (o Opcodes) Vscatterpf1qpd(ops ...Operand) { o.a.op("VSCATTERPF1QPD", ops...) } func (o Opcodes) VSCATTERPF1QPD(ops ...Operand) { o.a.op("VSCATTERPF1QPD", ops...) } func (o Opcodes) Vscatterpf1qps(ops ...Operand) { o.a.op("VSCATTERPF1QPS", ops...) } func (o Opcodes) VSCATTERPF1QPS(ops ...Operand) { o.a.op("VSCATTERPF1QPS", ops...) } func (o Opcodes) Vscatterqpd(ops ...Operand) { o.a.op("VSCATTERQPD", ops...) } func (o Opcodes) VSCATTERQPD(ops ...Operand) { o.a.op("VSCATTERQPD", ops...) } func (o Opcodes) Vscatterqps(ops ...Operand) { o.a.op("VSCATTERQPS", ops...) } func (o Opcodes) VSCATTERQPS(ops ...Operand) { o.a.op("VSCATTERQPS", ops...) } func (o Opcodes) Vshuff32x4(ops ...Operand) { o.a.op("VSHUFF32X4", ops...) } func (o Opcodes) VSHUFF32X4(ops ...Operand) { o.a.op("VSHUFF32X4", ops...) } func (o Opcodes) Vshuff64x2(ops ...Operand) { o.a.op("VSHUFF64X2", ops...) } func (o Opcodes) VSHUFF64X2(ops ...Operand) { o.a.op("VSHUFF64X2", ops...) } func (o Opcodes) Vshufi32x4(ops ...Operand) { o.a.op("VSHUFI32X4", ops...) } func (o Opcodes) VSHUFI32X4(ops ...Operand) { o.a.op("VSHUFI32X4", ops...) } func (o Opcodes) Vshufi64x2(ops ...Operand) { o.a.op("VSHUFI64X2", ops...) } func (o Opcodes) VSHUFI64X2(ops ...Operand) { o.a.op("VSHUFI64X2", ops...) } func (o Opcodes) Vshufpd(ops ...Operand) { o.a.op("VSHUFPD", ops...) } func (o Opcodes) VSHUFPD(ops ...Operand) { o.a.op("VSHUFPD", ops...) } func (o Opcodes) Vshufps(ops ...Operand) { o.a.op("VSHUFPS", ops...) } func (o Opcodes) VSHUFPS(ops ...Operand) { o.a.op("VSHUFPS", ops...) } func (o Opcodes) Vsqrtpd(ops ...Operand) { o.a.op("VSQRTPD", ops...) } func (o Opcodes) VSQRTPD(ops ...Operand) { o.a.op("VSQRTPD", ops...) } func (o Opcodes) Vsqrtps(ops ...Operand) { o.a.op("VSQRTPS", ops...) } func (o Opcodes) VSQRTPS(ops ...Operand) { o.a.op("VSQRTPS", ops...) } func (o Opcodes) Vsqrtsd(ops ...Operand) { o.a.op("VSQRTSD", ops...) } func (o Opcodes) VSQRTSD(ops ...Operand) { o.a.op("VSQRTSD", ops...) } func (o Opcodes) Vsqrtss(ops ...Operand) { o.a.op("VSQRTSS", ops...) } func (o Opcodes) VSQRTSS(ops ...Operand) { o.a.op("VSQRTSS", ops...) } func (o Opcodes) Vstmxcsr(ops ...Operand) { o.a.op("VSTMXCSR", ops...) } func (o Opcodes) VSTMXCSR(ops ...Operand) { o.a.op("VSTMXCSR", ops...) } func (o Opcodes) Vsubpd(ops ...Operand) { o.a.op("VSUBPD", ops...) } func (o Opcodes) VSUBPD(ops ...Operand) { o.a.op("VSUBPD", ops...) } func (o Opcodes) Vsubps(ops ...Operand) { o.a.op("VSUBPS", ops...) } func (o Opcodes) VSUBPS(ops ...Operand) { o.a.op("VSUBPS", ops...) } func (o Opcodes) Vsubsd(ops ...Operand) { o.a.op("VSUBSD", ops...) } func (o Opcodes) VSUBSD(ops ...Operand) { o.a.op("VSUBSD", ops...) } func (o Opcodes) Vsubss(ops ...Operand) { o.a.op("VSUBSS", ops...) } func (o Opcodes) VSUBSS(ops ...Operand) { o.a.op("VSUBSS", ops...) } func (o Opcodes) Vtestpd(ops ...Operand) { o.a.op("VTESTPD", ops...) } func (o Opcodes) VTESTPD(ops ...Operand) { o.a.op("VTESTPD", ops...) } func (o Opcodes) Vtestps(ops ...Operand) { o.a.op("VTESTPS", ops...) } func (o Opcodes) VTESTPS(ops ...Operand) { o.a.op("VTESTPS", ops...) } func (o Opcodes) Vucomisd(ops ...Operand) { o.a.op("VUCOMISD", ops...) } func (o Opcodes) VUCOMISD(ops ...Operand) { o.a.op("VUCOMISD", ops...) } func (o Opcodes) Vucomiss(ops ...Operand) { o.a.op("VUCOMISS", ops...) } func (o Opcodes) VUCOMISS(ops ...Operand) { o.a.op("VUCOMISS", ops...) } func (o Opcodes) Vunpckhpd(ops ...Operand) { o.a.op("VUNPCKHPD", ops...) } func (o Opcodes) VUNPCKHPD(ops ...Operand) { o.a.op("VUNPCKHPD", ops...) } func (o Opcodes) Vunpckhps(ops ...Operand) { o.a.op("VUNPCKHPS", ops...) } func (o Opcodes) VUNPCKHPS(ops ...Operand) { o.a.op("VUNPCKHPS", ops...) } func (o Opcodes) Vunpcklpd(ops ...Operand) { o.a.op("VUNPCKLPD", ops...) } func (o Opcodes) VUNPCKLPD(ops ...Operand) { o.a.op("VUNPCKLPD", ops...) } func (o Opcodes) Vunpcklps(ops ...Operand) { o.a.op("VUNPCKLPS", ops...) } func (o Opcodes) VUNPCKLPS(ops ...Operand) { o.a.op("VUNPCKLPS", ops...) } func (o Opcodes) Vxorpd(ops ...Operand) { o.a.op("VXORPD", ops...) } func (o Opcodes) VXORPD(ops ...Operand) { o.a.op("VXORPD", ops...) } func (o Opcodes) Vxorps(ops ...Operand) { o.a.op("VXORPS", ops...) } func (o Opcodes) VXORPS(ops ...Operand) { o.a.op("VXORPS", ops...) } func (o Opcodes) Vzeroall(ops ...Operand) { o.a.op("VZEROALL", ops...) } func (o Opcodes) VZEROALL(ops ...Operand) { o.a.op("VZEROALL", ops...) } func (o Opcodes) Vzeroupper(ops ...Operand) { o.a.op("VZEROUPPER", ops...) } func (o Opcodes) VZEROUPPER(ops ...Operand) { o.a.op("VZEROUPPER", ops...) } func (o Opcodes) Wait(ops ...Operand) { o.a.op("WAIT", ops...) } func (o Opcodes) WAIT(ops ...Operand) { o.a.op("WAIT", ops...) } func (o Opcodes) Wbinvd(ops ...Operand) { o.a.op("WBINVD", ops...) } func (o Opcodes) WBINVD(ops ...Operand) { o.a.op("WBINVD", ops...) } func (o Opcodes) Word(ops ...Operand) { o.a.op("WORD", ops...) } func (o Opcodes) WORD(ops ...Operand) { o.a.op("WORD", ops...) } func (o Opcodes) Wrfsbasel(ops ...Operand) { o.a.op("WRFSBASEL", ops...) } func (o Opcodes) WRFSBASEL(ops ...Operand) { o.a.op("WRFSBASEL", ops...) } func (o Opcodes) Wrfsbaseq(ops ...Operand) { o.a.op("WRFSBASEQ", ops...) } func (o Opcodes) WRFSBASEQ(ops ...Operand) { o.a.op("WRFSBASEQ", ops...) } func (o Opcodes) Wrgsbasel(ops ...Operand) { o.a.op("WRGSBASEL", ops...) } func (o Opcodes) WRGSBASEL(ops ...Operand) { o.a.op("WRGSBASEL", ops...) } func (o Opcodes) Wrgsbaseq(ops ...Operand) { o.a.op("WRGSBASEQ", ops...) } func (o Opcodes) WRGSBASEQ(ops ...Operand) { o.a.op("WRGSBASEQ", ops...) } func (o Opcodes) Wrmsr(ops ...Operand) { o.a.op("WRMSR", ops...) } func (o Opcodes) WRMSR(ops ...Operand) { o.a.op("WRMSR", ops...) } func (o Opcodes) Wrpkru(ops ...Operand) { o.a.op("WRPKRU", ops...) } func (o Opcodes) WRPKRU(ops ...Operand) { o.a.op("WRPKRU", ops...) } func (o Opcodes) Xabort(ops ...Operand) { o.a.op("XABORT", ops...) } func (o Opcodes) XABORT(ops ...Operand) { o.a.op("XABORT", ops...) } func (o Opcodes) Xacquire(ops ...Operand) { o.a.op("XACQUIRE", ops...) } func (o Opcodes) XACQUIRE(ops ...Operand) { o.a.op("XACQUIRE", ops...) } func (o Opcodes) Xaddb(ops ...Operand) { o.a.op("XADDB", ops...) } func (o Opcodes) XADDB(ops ...Operand) { o.a.op("XADDB", ops...) } func (o Opcodes) Xaddl(ops ...Operand) { o.a.op("XADDL", ops...) } func (o Opcodes) XADDL(ops ...Operand) { o.a.op("XADDL", ops...) } func (o Opcodes) Xaddq(ops ...Operand) { o.a.op("XADDQ", ops...) } func (o Opcodes) XADDQ(ops ...Operand) { o.a.op("XADDQ", ops...) } func (o Opcodes) Xaddw(ops ...Operand) { o.a.op("XADDW", ops...) } func (o Opcodes) XADDW(ops ...Operand) { o.a.op("XADDW", ops...) } func (o Opcodes) Xbegin(ops ...Operand) { o.a.op("XBEGIN", ops...) } func (o Opcodes) XBEGIN(ops ...Operand) { o.a.op("XBEGIN", ops...) } func (o Opcodes) Xchgb(ops ...Operand) { o.a.op("XCHGB", ops...) } func (o Opcodes) XCHGB(ops ...Operand) { o.a.op("XCHGB", ops...) } func (o Opcodes) Xchgl(ops ...Operand) { o.a.op("XCHGL", ops...) } func (o Opcodes) XCHGL(ops ...Operand) { o.a.op("XCHGL", ops...) } func (o Opcodes) Xchgq(ops ...Operand) { o.a.op("XCHGQ", ops...) } func (o Opcodes) XCHGQ(ops ...Operand) { o.a.op("XCHGQ", ops...) } func (o Opcodes) Xchgw(ops ...Operand) { o.a.op("XCHGW", ops...) } func (o Opcodes) XCHGW(ops ...Operand) { o.a.op("XCHGW", ops...) } func (o Opcodes) Xend(ops ...Operand) { o.a.op("XEND", ops...) } func (o Opcodes) XEND(ops ...Operand) { o.a.op("XEND", ops...) } func (o Opcodes) Xgetbv(ops ...Operand) { o.a.op("XGETBV", ops...) } func (o Opcodes) XGETBV(ops ...Operand) { o.a.op("XGETBV", ops...) } func (o Opcodes) Xlat(ops ...Operand) { o.a.op("XLAT", ops...) } func (o Opcodes) XLAT(ops ...Operand) { o.a.op("XLAT", ops...) } func (o Opcodes) Xorb(ops ...Operand) { o.a.op("XORB", ops...) } func (o Opcodes) XORB(ops ...Operand) { o.a.op("XORB", ops...) } func (o Opcodes) Xorl(ops ...Operand) { o.a.op("XORL", ops...) } func (o Opcodes) XORL(ops ...Operand) { o.a.op("XORL", ops...) } func (o Opcodes) Xorpd(ops ...Operand) { o.a.op("XORPD", ops...) } func (o Opcodes) XORPD(ops ...Operand) { o.a.op("XORPD", ops...) } func (o Opcodes) Xorps(ops ...Operand) { o.a.op("XORPS", ops...) } func (o Opcodes) XORPS(ops ...Operand) { o.a.op("XORPS", ops...) } func (o Opcodes) Xorq(ops ...Operand) { o.a.op("XORQ", ops...) } func (o Opcodes) XORQ(ops ...Operand) { o.a.op("XORQ", ops...) } func (o Opcodes) Xorw(ops ...Operand) { o.a.op("XORW", ops...) } func (o Opcodes) XORW(ops ...Operand) { o.a.op("XORW", ops...) } func (o Opcodes) Xrelease(ops ...Operand) { o.a.op("XRELEASE", ops...) } func (o Opcodes) XRELEASE(ops ...Operand) { o.a.op("XRELEASE", ops...) } func (o Opcodes) Xrstor(ops ...Operand) { o.a.op("XRSTOR", ops...) } func (o Opcodes) XRSTOR(ops ...Operand) { o.a.op("XRSTOR", ops...) } func (o Opcodes) Xrstor64(ops ...Operand) { o.a.op("XRSTOR64", ops...) } func (o Opcodes) XRSTOR64(ops ...Operand) { o.a.op("XRSTOR64", ops...) } func (o Opcodes) Xrstors(ops ...Operand) { o.a.op("XRSTORS", ops...) } func (o Opcodes) XRSTORS(ops ...Operand) { o.a.op("XRSTORS", ops...) } func (o Opcodes) Xrstors64(ops ...Operand) { o.a.op("XRSTORS64", ops...) } func (o Opcodes) XRSTORS64(ops ...Operand) { o.a.op("XRSTORS64", ops...) } func (o Opcodes) Xsave(ops ...Operand) { o.a.op("XSAVE", ops...) } func (o Opcodes) XSAVE(ops ...Operand) { o.a.op("XSAVE", ops...) } func (o Opcodes) Xsave64(ops ...Operand) { o.a.op("XSAVE64", ops...) } func (o Opcodes) XSAVE64(ops ...Operand) { o.a.op("XSAVE64", ops...) } func (o Opcodes) Xsavec(ops ...Operand) { o.a.op("XSAVEC", ops...) } func (o Opcodes) XSAVEC(ops ...Operand) { o.a.op("XSAVEC", ops...) } func (o Opcodes) Xsavec64(ops ...Operand) { o.a.op("XSAVEC64", ops...) } func (o Opcodes) XSAVEC64(ops ...Operand) { o.a.op("XSAVEC64", ops...) } func (o Opcodes) Xsaveopt(ops ...Operand) { o.a.op("XSAVEOPT", ops...) } func (o Opcodes) XSAVEOPT(ops ...Operand) { o.a.op("XSAVEOPT", ops...) } func (o Opcodes) Xsaveopt64(ops ...Operand) { o.a.op("XSAVEOPT64", ops...) } func (o Opcodes) XSAVEOPT64(ops ...Operand) { o.a.op("XSAVEOPT64", ops...) } func (o Opcodes) Xsaves(ops ...Operand) { o.a.op("XSAVES", ops...) } func (o Opcodes) XSAVES(ops ...Operand) { o.a.op("XSAVES", ops...) } func (o Opcodes) Xsaves64(ops ...Operand) { o.a.op("XSAVES64", ops...) } func (o Opcodes) XSAVES64(ops ...Operand) { o.a.op("XSAVES64", ops...) } func (o Opcodes) Xsetbv(ops ...Operand) { o.a.op("XSETBV", ops...) } func (o Opcodes) XSETBV(ops ...Operand) { o.a.op("XSETBV", ops...) } func (o Opcodes) Xtest(ops ...Operand) { o.a.op("XTEST", ops...) } func (o Opcodes) XTEST(ops ...Operand) { o.a.op("XTEST", ops...) } func (o Opcodes) Last(ops ...Operand) { o.a.op("LAST", ops...) } func (o Opcodes) LAST(ops ...Operand) { o.a.op("LAST", ops...) }
vendor/github.com/tmthrgd/asm/opcode.go
0.551574
0.526465
opcode.go
starcoder
// Package verifier allows client to verify a tree proof. package verifier import ( "bytes" "errors" "fmt" "github.com/google/key-transparency/core/tree" "github.com/google/key-transparency/core/tree/sparse" ) var ( // ErrNeighborsLen occurs when the neighbor list length is longer than // the maximum allowed value. ErrNeighborsLen = fmt.Errorf("Neighbors len > %d", sparse.IndexLen) // ErrIndexBit occurs when the string-formatted index contains an invalid // bit (character), i.e., other than '0' or '1'. ErrIndexBit = errors.New("Invalid index bit") // ErrInvalidProof occurs when the provided tree proof cannot be // verified. This can be caused by an invalid neighbor tree or root. ErrInvalidProof = errors.New("Invalid proof") ) // Verifier represents a sparse tree proof verifier object. type Verifier struct { mapID []byte hasher sparse.TreeHasher } // New returns a new tree proofs verifier object. func New(mapID []byte, hasher sparse.TreeHasher) *Verifier { return &Verifier{mapID, hasher} } // VerifyProof verifies a tree proof of a given leaf at a given index based on // the provided root and neighbor list func (v *Verifier) VerifyProof(neighbors [][]byte, index, leaf []byte, root sparse.Hash) error { if len(neighbors) > sparse.IndexLen { return ErrNeighborsLen } // Calculate the tree root based on neighbors and leaf. calculatedRoot, err := v.calculateRoot(neighbors, tree.BitString(index), leaf) if err != nil { return err } // Verify that calculated and provided roots match. if !bytes.Equal(calculatedRoot.Bytes(), root.Bytes()) { return ErrInvalidProof } return nil } // calculateRoot calculates the root of the tree branch defined by leaf and // neighbors. func (v *Verifier) calculateRoot(neighbors [][]byte, bindex string, leaf []byte) (sparse.Hash, error) { var leafHash sparse.Hash // If the leaf is empty, it is a proof of absence. if len(leaf) == 0 { // Trim the neighbors list. neighbors = trimNeighbors(neighbors) // Calculate the value of the empty leaf missingBranchBIndex := bindex[:len(neighbors)] index, depth := tree.InvertBitString(missingBranchBIndex) leafHash = v.hasher.HashEmpty(v.mapID, index, depth) } else { index, depth := tree.InvertBitString(bindex) leafHash = v.hasher.HashLeaf(v.mapID, index, depth, leaf) } // calculatedRoot holds the calculated root so far, starting from leaf. calculatedRoot := leafHash for i, neighbor := range neighbors { // TODO convert trimNeighbors to return Hash values. var neighborHash sparse.Hash // Get the neighbor bit string index. neighborBIndex := tree.NeighborString(bindex[:len(neighbors)-i]) // If the neighbor is empty, set it to HashEmpty output. if len(neighbor) == 0 { nIndex, nDepth := tree.InvertBitString(neighborBIndex) neighborHash = v.hasher.HashEmpty(v.mapID, nIndex, nDepth) } else { neighborHash = sparse.FromBytes(neighbor) } // The leaf index is processed starting from len(neighbors)-1 // down to 0. If the index bit is 0, then neighbor is on the // right, otherwise, neighbor is on the left. switch bindex[len(neighbors)-1-i] { case tree.Zero: calculatedRoot = v.hasher.HashInterior(calculatedRoot, neighborHash) case tree.One: calculatedRoot = v.hasher.HashInterior(neighborHash, calculatedRoot) default: return sparse.Hash{}, ErrIndexBit } } return calculatedRoot, nil } // trimNeighbors trims all the empty values at the beginning of the neighbors // list. The returned list is the one used in the proof of absence. func trimNeighbors(neighbors [][]byte) [][]byte { for i, v := range neighbors { if len(v) != 0 { return neighbors[i:] } } return [][]byte{} }
core/tree/sparse/verifier/verifier.go
0.680029
0.482917
verifier.go
starcoder
package tracker import ( "time" "github.com/tellor-io/telliot/pkg/apiOracle" ) type Ampl struct { granularity float64 } func (a Ampl) Require(at time.Time) map[string]IndexProcessor { return map[string]IndexProcessor{ "AMPL/USD": VolumeWeightedAPIs(TimeWeightedAvg(24*time.Hour, NoDecay)), "AMPL/BTC": AmpleChained("BTC/USD"), "AMPL/ETH": TimeWeightedAvg(24*time.Hour, NoDecay), "AMPL/USDC": TimeWeightedAvg(24*time.Hour, NoDecay), } } func (a Ampl) ValueAt(vals map[string]apiOracle.PriceInfo, at time.Time) float64 { valSlice := make([]apiOracle.PriceInfo, 0, len(vals)) for _, v := range vals { valSlice = append(valSlice, v) } return VolumeWeightedAvg(valSlice).Price * a.granularity } func (s *Ampl) Granularity() int64 { return int64(s.granularity) } // compute the average ampl price over a 24 hour period using a chained price feed. func AmpleChained(chainedPair string) IndexProcessor { return func(apis []*IndexTracker, at time.Time) (apiOracle.PriceInfo, float64, error) { eod := clck.Now().UTC() d := 24 * time.Hour eod = eod.Truncate(d) eod = eod.Add(2 * time.Hour) //Get the value always at 2am UTC //time weight individual 10 minute buckets //VWAP based on time at 2am numVals := 0 sum := 0.0 maxVolume := 0.0 interval := 10 * time.Minute //function to collect API values over an interval apiFn := VolumeWeightedAPIs(TimeWeightedAvg(interval, NoDecay)) for i := 0; i < 144; i++ { thisTime := eod.Add(time.Duration(-i) * interval) chainedPrice, confidence, err := MedianAt(indexes[chainedPair], thisTime) if err != nil { return apiOracle.PriceInfo{}, 0, nil } if confidence < 0.01 { //we don't have an accurate estimate of the intermediary price, so we can't convert the AMPL price to USD continue } avg, confidence, err := apiFn(apis, thisTime) if err != nil { return apiOracle.PriceInfo{}, 0, nil } if confidence < 0.01 { //our estimate of AMPL/intermediary is not good enough right now continue } sum += avg.Price * chainedPrice.Price if avg.Volume > maxVolume { maxVolume = avg.Volume } numVals++ } var result apiOracle.PriceInfo result.Price = sum / float64(numVals) result.Volume = maxVolume if sum > 0 { return result, float64(numVals) / 144.0, nil } else { return result, 0, nil } } }
pkg/tracker/ampl.go
0.647241
0.41478
ampl.go
starcoder
package tsm1 // boolean encoding uses 1 bit per value. Each compressed byte slice contains a 1 byte header // indicating the compression type, followed by a variable byte encoded length indicating // how many booleans are packed in the slice. The remaining bytes contains 1 byte for every // 8 boolean values encoded. import ( "encoding/binary" "fmt" ) // Note: an uncompressed boolean format is not yet implemented. // booleanCompressedBitPacked is a bit packed format using 1 bit per boolean const booleanCompressedBitPacked = 1 // BooleanEncoder encodes a series of booleans to an in-memory buffer. type BooleanEncoder struct { // The encoded bytes bytes []byte // The current byte being encoded b byte // The number of bools packed into b i int // The total number of bools written n int } // NewBooleanEncoder returns a new instance of BooleanEncoder. func NewBooleanEncoder(sz int) BooleanEncoder { return BooleanEncoder{ bytes: make([]byte, 0, (sz+7)/8), } } // Reset sets the encoder to its initial state. func (e *BooleanEncoder) Reset() { e.bytes = e.bytes[:0] e.b = 0 e.i = 0 e.n = 0 } // Write encodes b to the underlying buffer. func (e *BooleanEncoder) Write(b bool) { // If we have filled the current byte, flush it if e.i >= 8 { e.flush() } // Use 1 bit for each boolean value, shift the current byte // by 1 and set the least significant bit accordingly e.b = e.b << 1 if b { e.b |= 1 } // Increment the current boolean count e.i++ // Increment the total boolean count e.n++ } func (e *BooleanEncoder) flush() { // Pad remaining byte w/ 0s for e.i < 8 { e.b = e.b << 1 e.i++ } // If we have bits set, append them to the byte slice if e.i > 0 { e.bytes = append(e.bytes, e.b) e.b = 0 e.i = 0 } } // Flush is no-op func (e *BooleanEncoder) Flush() {} // Bytes returns a new byte slice containing the encoded booleans from previous calls to Write. func (e *BooleanEncoder) Bytes() ([]byte, error) { // Ensure the current byte is flushed e.flush() b := make([]byte, 10+1) // Store the encoding type in the 4 high bits of the first byte b[0] = byte(booleanCompressedBitPacked) << 4 i := 1 // Encode the number of booleans written i += binary.PutUvarint(b[i:], uint64(e.n)) // Append the packed booleans return append(b[:i], e.bytes...), nil } // BooleanDecoder decodes a series of booleans from an in-memory buffer. type BooleanDecoder struct { b []byte i int n int err error } // SetBytes initializes the decoder with a new set of bytes to read from. // This must be called before calling any other methods. func (e *BooleanDecoder) SetBytes(b []byte) { if len(b) == 0 { return } // First byte stores the encoding type, only have 1 bit-packet format // currently ignore for now. b = b[1:] count, n := binary.Uvarint(b) if n <= 0 { e.err = fmt.Errorf("booleanDecoder: invalid count") return } e.b = b[n:] e.i = -1 e.n = int(count) if min := len(e.b) * 8; min < e.n { // Shouldn't happen - TSM file was truncated/corrupted e.n = min } } // Next returns whether there are any bits remaining in the decoder. // It returns false if there was an error decoding. // The error is available on the Error method. func (e *BooleanDecoder) Next() bool { if e.err != nil { return false } e.i++ return e.i < e.n } // Read returns the next bit from the decoder. func (e *BooleanDecoder) Read() bool { // Index into the byte slice idx := e.i >> 3 // integer division by 8 // Bit position pos := 7 - (e.i & 0x7) // The mask to select the bit mask := byte(1 << uint(pos)) // The packed byte v := e.b[idx] // Returns true if the bit is set return v&mask == mask } // Error returns the error encountered during decoding, if one occurred. func (e *BooleanDecoder) Error() error { return e.err }
tsdb/tsm1/bool.go
0.883009
0.541773
bool.go
starcoder
package binomial_theorem import ( "fmt" "math" "strings" "strconv" ) type expression struct { literals []literal value int exp int } func Multiply(a *expression, b *expression) *expression { expr := expression{literals: []literal{}, value: 0, exp: 1} a = a.Expand() b = b.Expand() expr.value = a.value * b.value expr.literals = Expand(append(a.literals, b.literals...)) return &expr } func (expr *expression) Expand() *expression { if expr.exp == 0 { return &expression{literals: []literal{}, value: 1, exp: 1} } if expr.value == 0 { return &expression{literals: []literal{}, value: 0, exp: 1} } n := &expression{literals: expr.literals, value: expr.value, exp: expr.exp} for i := 1; i < expr.exp; i ++ { n.value *= expr.value n.literals = Expand(append(n.literals, expr.literals...)) n.exp -= 1 } return n } func (expr *expression) String() string { var s strings.Builder absValue := int(math.Abs(float64(expr.value))) if expr.exp != 1 && len(expr.literals) > 1 { fmt.Fprintf(&s, "(") } if expr.value < 0 { fmt.Fprintf(&s, "-") } if absValue != 1 || len(expr.literals) == 0 { fmt.Fprintf(&s, "%d", absValue) } ls := GroupByExponent(expr.literals) for _, lg := range ls { for _, l := range lg { if l.exp != 0 { fmt.Fprintf(&s, "%s", l.name) } } if lg[0].exp > 1 { fmt.Fprintf(&s, "^%d", lg[0].exp) } } if expr.exp != 1 && len(expr.literals) > 1 { fmt.Fprintf(&s, ")") } if expr.exp != 1 { fmt.Fprintf(&s, "^%d", expr.exp) } return s.String() } func ParseExpression(str string) *expression { rgx := `^(?P<value>[\+,-]?\d*)(?P<literal>[a-z]*)$` result := RegexGroup(rgx, str) v, err := strconv.Atoi(result["value"]) if err != nil { if result["value"] == "" { v = 1 } else if result["value"] == "-" { v = -1 } else { panic(err) } } exp, err := strconv.Atoi(result["exp"]) if err != nil { exp = 1 } ls := []literal{} for _, l := range strings.Split(result["literal"], "") { ls = append(ls, literal{l, 1}) } return &expression{ literals: ls, value: v, exp: exp, } }
expression.go
0.506347
0.415432
expression.go
starcoder
package dist import ( "bitbucket.org/dtolpin/infergo/ad" "bitbucket.org/dtolpin/infergo/mathx" "fmt" "math" ) var ( logpi, log2pi float64 ) func init() { log2 := math.Log(2) logpi = math.Log(math.Pi) log2pi = log2 + logpi } type normal struct{} var Normal normal func (dist normal) Observe(x []float64) float64 { if ad.Called() { ad.Enter() } else { ad.Setup(x) } var ( mu float64 sigma float64 y []float64 ) mu, sigma, y = x[0], x[1], x[2:] if len(y) == 1 { return ad.Return(ad.Call(func(_ []float64) { dist.Logp(0, 0, 0) }, 3, &mu, &sigma, &y[0])) } else { return ad.Return(ad.Call(func(_ []float64) { dist.Logps(0, 0, y...) }, 2, &mu, &sigma)) } } func (normal) Logp(mu, sigma float64, y float64) float64 { if ad.Called() { ad.Enter(&mu, &sigma, &y) } else { panic("Logp called outside Observe") } var vari float64 ad.Assignment(&vari, ad.Arithmetic(ad.OpMul, &sigma, &sigma)) var logv float64 ad.Assignment(&logv, ad.Elemental(math.Log, &vari)) var d float64 ad.Assignment(&d, ad.Arithmetic(ad.OpSub, &y, &mu)) return ad.Return(ad.Arithmetic(ad.OpMul, ad.Value(-0.5), (ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpDiv, ad.Arithmetic(ad.OpMul, &d, &d), &vari), &logv), &log2pi)))) } func (normal) Logps(mu, sigma float64, y ...float64) float64 { if ad.Called() { ad.Enter(&mu, &sigma) } else { panic("Logps called outside Observe") } var vari float64 ad.Assignment(&vari, ad.Arithmetic(ad.OpMul, &sigma, &sigma)) var logv float64 ad.Assignment(&logv, ad.Elemental(math.Log, &vari)) var lp float64 ad.Assignment(&lp, ad.Arithmetic(ad.OpMul, ad.Arithmetic(ad.OpMul, ad.Value(-0.5), (ad.Arithmetic(ad.OpAdd, &logv, &log2pi))), ad.Value(float64(len(y))))) for i := range y { var d float64 ad.Assignment(&d, ad.Arithmetic(ad.OpSub, &y[i], &mu)) ad.Assignment(&lp, ad.Arithmetic(ad.OpSub, &lp, ad.Arithmetic(ad.OpDiv, ad.Arithmetic(ad.OpMul, ad.Arithmetic(ad.OpMul, ad.Value(0.5), &d), &d), &vari))) } return ad.Return(&lp) } type cauchy struct{} var Cauchy cauchy func (dist cauchy) Observe(x []float64) float64 { if ad.Called() { ad.Enter() } else { ad.Setup(x) } var ( mu float64 sigma float64 y []float64 ) mu, sigma, y = x[0], x[1], x[2:] if len(y) == 1 { return ad.Return(ad.Call(func(_ []float64) { dist.Logp(0, 0, 0) }, 3, &mu, &sigma, &y[0])) } else { return ad.Return(ad.Call(func(_ []float64) { dist.Logps(0, 0, y...) }, 2, &mu, &sigma)) } } func (cauchy) Logp(x0, gamma float64, y float64) float64 { if ad.Called() { ad.Enter(&x0, &gamma, &y) } else { panic("Logp called outside Observe") } var logGamma float64 ad.Assignment(&logGamma, ad.Elemental(math.Log, &gamma)) var d float64 ad.Assignment(&d, ad.Arithmetic(ad.OpDiv, (ad.Arithmetic(ad.OpSub, &y, &x0)), &gamma)) return ad.Return(ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpNeg, &logGamma), &logpi), ad.Elemental(math.Log, ad.Arithmetic(ad.OpAdd, ad.Value(1), ad.Arithmetic(ad.OpMul, &d, &d))))) } func (cauchy) Logps(x0, gamma float64, y ...float64) float64 { if ad.Called() { ad.Enter(&x0, &gamma) } else { panic("Logps called outside Observe") } var logGamma float64 ad.Assignment(&logGamma, ad.Elemental(math.Log, &gamma)) var lp float64 ad.Assignment(&lp, ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpNeg, &logGamma), &logpi)), ad.Value(float64(len(y))))) for i := range y { var d float64 ad.Assignment(&d, ad.Arithmetic(ad.OpDiv, (ad.Arithmetic(ad.OpSub, &y[i], &x0)), &gamma)) ad.Assignment(&lp, ad.Arithmetic(ad.OpSub, &lp, ad.Elemental(math.Log, ad.Arithmetic(ad.OpAdd, ad.Value(1), ad.Arithmetic(ad.OpMul, &d, &d))))) } return ad.Return(&lp) } type exponential struct{} var Exponential, Expon exponential func (dist exponential) Observe(x []float64) float64 { if ad.Called() { ad.Enter() } else { ad.Setup(x) } var ( lambda float64 y []float64 ) lambda, y = x[0], x[1:] if len(y) == 1 { return ad.Return(ad.Call(func(_ []float64) { dist.Logp(0, 0) }, 2, &lambda, &y[0])) } else { return ad.Return(ad.Call(func(_ []float64) { dist.Logps(0, y...) }, 1, &lambda)) } } func (exponential) Logp(lambda float64, y float64) float64 { if ad.Called() { ad.Enter(&lambda, &y) } else { panic("Logp called outside Observe") } var logl float64 ad.Assignment(&logl, ad.Elemental(math.Log, &lambda)) return ad.Return(ad.Arithmetic(ad.OpSub, &logl, ad.Arithmetic(ad.OpMul, &lambda, &y))) } func (exponential) Logps(lambda float64, y ...float64) float64 { if ad.Called() { ad.Enter(&lambda) } else { panic("Logps called outside Observe") } var logl float64 ad.Assignment(&logl, ad.Elemental(math.Log, &lambda)) var lp float64 ad.Assignment(&lp, ad.Arithmetic(ad.OpMul, &logl, ad.Value(float64(len(y))))) for i := range y { ad.Assignment(&lp, ad.Arithmetic(ad.OpSub, &lp, ad.Arithmetic(ad.OpMul, &lambda, &y[i]))) } return ad.Return(&lp) } type gamma struct{} var Gamma gamma func (dist gamma) Observe(x []float64) float64 { if ad.Called() { ad.Enter() } else { ad.Setup(x) } var ( alpha float64 beta float64 y []float64 ) alpha, beta, y = x[0], x[1], x[2:] if len(y) == 1 { return ad.Return(ad.Call(func(_ []float64) { dist.Logp(0, 0, 0) }, 3, &alpha, &beta, &y[0])) } else { return ad.Return(ad.Call(func(_ []float64) { dist.Logps(0, 0, y...) }, 2, &alpha, &beta)) } } func (gamma) Logp(alpha, beta float64, y float64) float64 { if ad.Called() { ad.Enter(&alpha, &beta, &y) } else { panic("Logp called outside Observe") } return ad.Return(ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, &alpha, ad.Value(1))), ad.Elemental(math.Log, &y)), ad.Arithmetic(ad.OpMul, &beta, &y)), ad.Elemental(mathx.LogGamma, &alpha)), ad.Arithmetic(ad.OpMul, &alpha, ad.Elemental(math.Log, &beta)))) } func (gamma) Logps(alpha, beta float64, y ...float64) float64 { if ad.Called() { ad.Enter(&alpha, &beta) } else { panic("Logps called outside Observe") } var lp float64 ad.Assignment(&lp, ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpNeg, ad.Elemental(mathx.LogGamma, &alpha)), ad.Arithmetic(ad.OpMul, &alpha, ad.Elemental(math.Log, &beta)))), ad.Value(float64(len(y))))) for i := range y { ad.Assignment(&lp, ad.Arithmetic(ad.OpAdd, &lp, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, &alpha, ad.Value(1))), ad.Elemental(math.Log, &y[i])), ad.Arithmetic(ad.OpMul, &beta, &y[i])))) } return ad.Return(&lp) } type beta struct{} var Beta beta func (dist beta) Observe(x []float64) float64 { if ad.Called() { ad.Enter() } else { ad.Setup(x) } var ( alpha float64 beta float64 y []float64 ) alpha, beta, y = x[0], x[1], x[2:] if len(y) == 1 { return ad.Return(ad.Call(func(_ []float64) { dist.Logp(0, 0, 0) }, 3, &alpha, &beta, &y[0])) } else { return ad.Return(ad.Call(func(_ []float64) { dist.Logps(0, 0, y...) }, 2, &alpha, &beta)) } } func (beta) Logp(alpha, beta float64, y float64) float64 { if ad.Called() { ad.Enter(&alpha, &beta, &y) } else { panic("Logp called outside Observe") } return ad.Return(ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, &alpha, ad.Value(1))), ad.Elemental(math.Log, &y)), ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, &beta, ad.Value(1))), ad.Elemental(math.Log, ad.Arithmetic(ad.OpSub, ad.Value(1), &y)))), ad.Elemental(mathx.LogGamma, &alpha)), ad.Elemental(mathx.LogGamma, &beta)), ad.Elemental(mathx.LogGamma, ad.Arithmetic(ad.OpAdd, &alpha, &beta)))) } func (beta) Logps(alpha, beta float64, y ...float64) float64 { if ad.Called() { ad.Enter(&alpha, &beta) } else { panic("Logps called outside Observe") } var lp float64 ad.Assignment(&lp, ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpNeg, ad.Elemental(mathx.LogGamma, &alpha)), ad.Elemental(mathx.LogGamma, &beta)), ad.Elemental(mathx.LogGamma, ad.Arithmetic(ad.OpAdd, &alpha, &beta)))), ad.Value(float64(len(y))))) for i := range y { ad.Assignment(&lp, ad.Arithmetic(ad.OpAdd, &lp, ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, &alpha, ad.Value(1))), ad.Elemental(math.Log, &y[i])), ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, &beta, ad.Value(1))), ad.Elemental(math.Log, ad.Arithmetic(ad.OpSub, ad.Value(1), &y[i])))))) } return ad.Return(&lp) } type binomial struct{} var Binomial binomial func (dist binomial) Observe(x []float64) float64 { if ad.Called() { ad.Enter() } else { ad.Setup(x) } var ( n float64 p float64 y []float64 ) n, p, y = x[0], x[1], x[2:] if len(y) == 1 { return ad.Return(ad.Call(func(_ []float64) { dist.Logp(0, 0, 0) }, 3, &n, &p, &y[0])) } else { return ad.Return(ad.Call(func(_ []float64) { dist.Logps(0, 0, y...) }, 2, &n, &p)) } } func (binomial) Logp(n, p float64, y float64) float64 { if ad.Called() { ad.Enter(&n, &p, &y) } else { panic("Logp called outside Observe") } return ad.Return(ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpMul, &y, ad.Elemental(math.Log, &p)), ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, &n, &y)), ad.Elemental(math.Log, ad.Arithmetic(ad.OpSub, ad.Value(1), &p)))), ad.Elemental(mathx.LogGamma, ad.Arithmetic(ad.OpAdd, &y, ad.Value(1)))), ad.Elemental(mathx.LogGamma, ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpSub, &n, &y), ad.Value(1)))), ad.Elemental(mathx.LogGamma, ad.Arithmetic(ad.OpAdd, &n, ad.Value(1))))) } func (binomial) Logps(n, p float64, y ...float64) float64 { if ad.Called() { ad.Enter(&n, &p) } else { panic("Logps called outside Observe") } var lp float64 ad.Assignment(&lp, ad.Arithmetic(ad.OpMul, ad.Elemental(mathx.LogGamma, ad.Arithmetic(ad.OpAdd, &n, ad.Value(1))), ad.Value(float64(len(y))))) for i := range y { ad.Assignment(&lp, ad.Arithmetic(ad.OpAdd, &lp, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpSub, ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpMul, &y[i], ad.Elemental(math.Log, &p)), ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, &n, &y[i])), ad.Elemental(math.Log, ad.Arithmetic(ad.OpSub, ad.Value(1), &p)))), ad.Elemental(mathx.LogGamma, ad.Arithmetic(ad.OpAdd, &y[i], ad.Value(1)))), ad.Elemental(mathx.LogGamma, ad.Arithmetic(ad.OpAdd, ad.Arithmetic(ad.OpSub, &n, &y[i]), ad.Value(1)))))) } return ad.Return(&lp) } type Dirichlet struct { N int } var Dir Dirichlet func (dist Dirichlet) Observe(x []float64) float64 { if ad.Called() { ad.Enter() } else { ad.Setup(x) } var alpha []float64 alpha = x[:dist.N] if len(x[dist.N:]) == dist.N { return ad.Return(ad.Call(func(_ []float64) { dist.Logp(alpha, x[dist.N:]) }, 0)) } else { var ys [][]float64 ys = make([][]float64, len(x[dist.N:])/dist.N) for i := range ys { ys[i] = x[dist.N*(i+1) : dist.N*(i+2)] } return ad.Return(ad.Call(func(_ []float64) { dist.Logps(alpha, ys...) }, 0)) } } func (dist Dirichlet) Logp(alpha []float64, y []float64) float64 { if ad.Called() { ad.Enter() } else { panic("Logp called outside Observe") } var sum float64 ad.Assignment(&sum, ad.Value(0.)) for j := range y { ad.Assignment(&sum, ad.Arithmetic(ad.OpAdd, &sum, ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, &alpha[j], ad.Value(1))), ad.Elemental(math.Log, &y[j])))) } return ad.Return(ad.Arithmetic(ad.OpSub, &sum, ad.Call(func(_ []float64) { dist.logZ(alpha) }, 0))) } func (dist Dirichlet) Logps(alpha []float64, y ...[]float64) float64 { if ad.Called() { ad.Enter() } else { panic("Logps called outside Observe") } var logZ float64 ad.Assignment(&logZ, ad.Call(func(_ []float64) { dist.logZ(alpha) }, 0)) var lp float64 ad.Assignment(&lp, ad.Arithmetic(ad.OpMul, ad.Arithmetic(ad.OpNeg, &logZ), ad.Value(float64(len(y))))) for i := range y { for j := range alpha { ad.Assignment(&lp, ad.Arithmetic(ad.OpAdd, &lp, ad.Arithmetic(ad.OpMul, (ad.Arithmetic(ad.OpSub, &alpha[j], ad.Value(1))), ad.Elemental(math.Log, &y[i][j])))) } } return ad.Return(&lp) } func (dist Dirichlet) logZ(alpha []float64) float64 { if ad.Called() { ad.Enter() } else { panic("logZ called outside Observe") } var sumAlpha float64 ad.Assignment(&sumAlpha, ad.Value(0.)) var sumLogGammaAlpha float64 ad.Assignment(&sumLogGammaAlpha, ad.Value(0.)) for i := range alpha { ad.Assignment(&sumAlpha, ad.Arithmetic(ad.OpAdd, &sumAlpha, &alpha[i])) ad.Assignment(&sumLogGammaAlpha, ad.Arithmetic(ad.OpAdd, &sumLogGammaAlpha, ad.Elemental(mathx.LogGamma, &alpha[i]))) } return ad.Return(ad.Arithmetic(ad.OpSub, &sumLogGammaAlpha, ad.Elemental(mathx.LogGamma, &sumAlpha))) } type bernoulli struct{} var Bernoulli bernoulli func (dist bernoulli) Observe(x []float64) float64 { if ad.Called() { ad.Enter() } else { ad.Setup(x) } var ( p float64 y []float64 ) p, y = x[0], x[1:] if len(y) == 1 { return ad.Return(ad.Call(func(_ []float64) { dist.Logp(0, 0) }, 2, &p, &y[0])) } else { return ad.Return(ad.Call(func(_ []float64) { dist.Logps(0, y...) }, 1, &p)) } } func (bernoulli) Logp(p float64, y float64) float64 { if ad.Called() { ad.Enter(&p, &y) } else { panic("Logp called outside Observe") } if y >= 0.5 { return ad.Return(ad.Elemental(math.Log, &p)) } else { return ad.Return(ad.Elemental(math.Log, ad.Arithmetic(ad.OpSub, ad.Value(1), &p))) } } func (bernoulli) Logps(p float64, y ...float64) float64 { if ad.Called() { ad.Enter(&p) } else { panic("Logps called outside Observe") } var lp float64 ad.Assignment(&lp, ad.Value(0.)) for i := range y { if y[i] >= 0.5 { ad.Assignment(&lp, ad.Arithmetic(ad.OpAdd, &lp, ad.Elemental(math.Log, &p))) } else { ad.Assignment(&lp, ad.Arithmetic(ad.OpAdd, &lp, ad.Elemental(math.Log, ad.Arithmetic(ad.OpSub, ad.Value(1), &p)))) } } return ad.Return(&lp) } type Categorical struct { N int } var Cat Categorical func (dist Categorical) Observe(x []float64) float64 { if ad.Called() { ad.Enter() } else { ad.Setup(x) } if len(x) == dist.N+1 { return ad.Return(ad.Call(func(_ []float64) { dist.Logp(x[:dist.N], 0) }, 1, &x[dist.N])) } else { return ad.Return(ad.Call(func(_ []float64) { dist.Logps(x[:dist.N], x[dist.N:]...) }, 0)) } } func (dist Categorical) Logp( alpha []float64, y float64, ) float64 { if ad.Called() { ad.Enter(&y) } else { panic("Logp called outside Observe") } var i int i = int(y) return ad.Return(ad.Arithmetic(ad.OpSub, ad.Elemental(math.Log, &alpha[i]), ad.Call(func(_ []float64) { dist.logZ(alpha) }, 0))) } func (dist Categorical) Logps( alpha []float64, y ...float64, ) float64 { if ad.Called() { ad.Enter() } else { panic("Logps called outside Observe") } var logZ float64 ad.Assignment(&logZ, ad.Call(func(_ []float64) { dist.logZ(alpha) }, 0)) var lp float64 ad.Assignment(&lp, ad.Arithmetic(ad.OpMul, ad.Arithmetic(ad.OpNeg, &logZ), ad.Value(float64(len(y))))) for i := range y { ad.Assignment(&lp, ad.Arithmetic(ad.OpAdd, &lp, ad.Elemental(math.Log, &alpha[int(y[i])]))) } return ad.Return(&lp) } func (dist Categorical) logZ(alpha []float64) float64 { if ad.Called() { ad.Enter() } else { panic("logZ called outside Observe") } var z float64 ad.Assignment(&z, ad.Value(0.)) for _, a := range alpha { ad.Assignment(&z, ad.Arithmetic(ad.OpAdd, &z, &a)) } return ad.Return(ad.Elemental(math.Log, &z)) } type d struct{} func (d) Observe(_ []float64) float64 { if ad.Called() { ad.Enter() } else { ad.Setup([]float64{}) } panic("should never be called") } var D d func (d) SoftMax(x, p []float64) { if ad.Called() { ad.Enter() } else { panic("SoftMax called outside Observe") } if len(x) != len(p) { panic(fmt.Sprintf("lengths of x and p are different: "+ "got len(x)=%v, len(p)=%v", len(x), len(p))) } var max float64 ad.Assignment(&max, ad.Value(math.Inf(-1))) for i := range x { if x[i] > max { ad.Assignment(&max, &x[i]) } } var z float64 ad.Assignment(&z, ad.Value(0.)) for i := range x { var q float64 ad.Assignment(&q, ad.Elemental(math.Exp, ad.Arithmetic(ad.OpSub, &x[i], &max))) ad.Assignment(&z, ad.Arithmetic(ad.OpAdd, &z, &q)) ad.Assignment(&p[i], &q) } for i := range p { ad.Assignment(&p[i], ad.Arithmetic(ad.OpDiv, &p[i], &z)) } } func (d) LogSumExp(x []float64) float64 { if ad.Called() { ad.Enter() } else { panic("LogSumExp called outside Observe") } var max float64 ad.Assignment(&max, ad.Value(math.Inf(-1))) for i := range x { if x[i] > max { ad.Assignment(&max, &x[i]) } } var sumExp float64 ad.Assignment(&sumExp, ad.Value(0.)) for i := range x { ad.Assignment(&sumExp, ad.Arithmetic(ad.OpAdd, &sumExp, ad.Elemental(math.Exp, ad.Arithmetic(ad.OpSub, &x[i], &max)))) } return ad.Return(ad.Arithmetic(ad.OpAdd, &max, ad.Elemental(math.Log, &sumExp))) }
dist/ad/dist.go
0.616705
0.437163
dist.go
starcoder
package graph import ( "github.com/hasansino/gobasics/structures/queue" "github.com/hasansino/gobasics/structures/stack" ) // Graph is ... well, a graph type Graph struct { size int nodes []*Node edges [][]*Edge // Adjacency Matrix } // Node of a graph type Node struct { value interface{} } // Edge of graph type Edge struct { weight int } // NewGraph creates new graph of given size func NewGraph(size int) *Graph { edges := make([][]*Edge, size) for i := 0; i < size; i++ { edges[i] = make([]*Edge, size) } return &Graph{ size: size, nodes: make([]*Node, 0, size), edges: edges, } } // Radius is minimum eccentricity of a graph func (g *Graph) Radius() int { return 0 } // Diameter is maximum eccentricity of a graph func (g *Graph) Diameter() int { return 0 } // CentralPoint is node whose eccentricity is equal to radius func (g *Graph) CentralPoint() int { return 0 } // Circumference returns number of edges in longest path of graph func (g *Graph) Circumference() int { return 0 } // Eccentricity returns maximum distance between given vertex n to any other func (g *Graph) Eccentricity() int { return 0 } // InsertNode into graph with given value // Returns index of insertion func (g *Graph) InsertNode(v interface{}) int { g.nodes = append(g.nodes, &Node{value: v}) return len(g.nodes) } // RemoveNode from graph func (g *Graph) RemoveNode(i int) { g.nodes[i] = nil for j := 0; j < g.size; j++ { g.edges[i][j] = nil } for j := 0; j < g.size; j++ { g.edges[j][i] = nil } } // CreateEdge between i and j with weight w and direction d func (g *Graph) CreateEdge(i, j, w int) { g.edges[i][j] = &Edge{weight: w} } // RemoveEdge between i and j func (g *Graph) RemoveEdge(i, j int) { g.edges[i][j] = nil } // Adjacent tests if i and j have an edge func (g *Graph) Adjacent(i, j int) bool { return g.edges[i][j] != nil || g.edges[j][i] != nil } // BreathFirstSearch of a graph // https://en.wikipedia.org/wiki/Breadth-first_search // https://afteracademy.com/blog/graph-traversal-breadth-first-search func (g *Graph) BreathFirstSearch(v interface{}) int { var ( q = queue.NewLLQueue(g.size) visited = make(map[int]bool, g.size) ) if err := q.Enqueue(0); err != nil { return -1 } for !q.Empty() { n := q.Dequeue().(int) if visited[n] { continue } if g.nodes[n].value == v { return n } visited[n] = true for j := 0; j < g.size; j++ { if g.edges[n][j] != nil { if err := q.Enqueue(j); err != nil { return -1 } } } } return -1 } // DepthFirstSearch of graph // https://en.wikipedia.org/wiki/Depth-first_search // https://afteracademy.com/blog/graph-traversal-depth-first-search func (g *Graph) DepthFirstSearch(v interface{}) int { var ( s = stack.NewLLStack() visited = make(map[int]bool, g.size) ) s.Push(0) for !s.Empty() { n := s.Pop().(int) if visited[n] { continue } if g.nodes[n].value == v { return n } visited[n] = true for j := 0; j < g.size; j++ { if g.edges[n][j] != nil { s.Push(j) } } } return -1 } // ShortestPathQueueItem with path already traversed for backtracking type ShortestPathQueueItem struct { path []int node int } // ShortestPath from root node to node with given value func (g *Graph) ShortestPath(v interface{}) []int { var ( q = queue.NewLLQueue(g.size) visited = make(map[int]bool, g.size) ) if err := q.Enqueue(ShortestPathQueueItem{ node: 0, path: make([]int, 0), }); err != nil { return nil } for !q.Empty() { qi := q.Dequeue().(ShortestPathQueueItem) if visited[qi.node] { continue } if g.nodes[qi.node].value == v { qi.path = append(qi.path, qi.node) return qi.path } visited[qi.node] = true for j := 0; j < g.size; j++ { if g.edges[qi.node][j] != nil { if err := q.Enqueue(ShortestPathQueueItem{ node: j, path: append(qi.path, qi.node), }); err != nil { return nil } } } } return nil } // DijkstrasShortestDistances algorithm // https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm // https://afteracademy.com/blog/dijkstras-algorithm func (g *Graph) DijkstrasShortestDistances(from int) []int { var ( visited = make([]bool, g.size) distances = make([]int, g.size) ) for j := 0; j < g.size; j++ { distances[j] = -1 // undefined } distances[from] = 0 for j := 0; j < g.size; j++ { next := g.dijkstrasShortestPathNextNode(visited, distances) visited[next] = true for k := 0; k < g.size; k++ { if !visited[k] && g.edges[next][k] != nil { if distances[k] < 0 || distances[next]+g.edges[next][k].weight < distances[k] { distances[k] = distances[next] + g.edges[next][k].weight } } } } return distances } func (g *Graph) dijkstrasShortestPathNextNode(visited []bool, distances []int) int { var minIdx = -1 for j := 0; j < g.size; j++ { if !visited[j] && distances[j] >= 0 && (minIdx == -1 || distances[j] < distances[minIdx]) { minIdx = j } } return minIdx }
structures/graph/graph.go
0.739893
0.417153
graph.go
starcoder
package types import ( "fmt" "sort" "strconv" "strings" ) var ( // NullPath means no path NullPath = Path([]string{}) // Dot means self - this. Dot = Path([]string{"."}) ) // RFC6901ToPath takes a path expression in the format of IETF RFC6901 (JSON pointer) and convert it to a Path func RFC6901ToPath(path string) Path { return rfc6901ToPath(strings.Split(path, "/")) } func rfc6901ToPath(path []string) Path { decoded := []string{} for _, p := range path { p = strings.Replace(p, `~1`, `/`, -1) p = strings.Replace(p, `~0`, `~`, -1) if _, err := strconv.Atoi(p); err == nil { p = fmt.Sprintf(`[%s]`, p) } decoded = append(decoded, p) } return Path(decoded) } // Path is used to identify a particle of metadata. The path can be strings separated by / as in a URL. type Path []string // PathFromString returns the path components of a / separated path func PathFromString(path string) Path { if path == "" { return Path([]string{}).Clean() // ==> . } return Path(strings.Split(path, "/")).Clean() } // PathFrom return a single path of the given components func PathFrom(a string, b ...string) Path { p := Path(append([]string{a}, b...)) return p.Clean() } // PathsFromStrings returns the path from a list of strings func PathsFromStrings(a string, b ...string) Paths { list := []Path{PathFromString(a)} for _, p := range b { list = append(list, PathFromString(p)) } return Paths(list) } // String returns the string representation of path func (p Path) String() string { s := strings.Join([]string(p), "/") if len(s) == 0 { return "." } return s } // Valid returns true if is a valid path func (p Path) Valid() bool { return p.Len() > 0 } // Dot returns true if this is a . func (p Path) Dot() bool { return len(p) == 1 && p[0] == "." } // Clean scrubs the path to remove any empty string or . or .. and collapse the path into a concise form. // It's similar to path.Clean in the standard lib. func (p Path) Clean() Path { this := []string(p) copy := []string{} for i, v := range this { switch v { case ".": case "": if i == 0 { copy = append(copy, "") } case "..": if len(copy) == 0 { copy = append(copy, "..") } else { copy = copy[0 : len(copy)-1] if len(copy) == 0 { return NullPath } } default: copy = append(copy, v) } } if len(copy) == 0 { copy = []string{"."} } else if this[len(this)-1] == "" || this[len(this)-1] == "." { if len(this)-2 > -1 { copy = append(copy, "") } } return Path(copy) } // Len returns the length of the path func (p Path) Len() int { return len([]string(p)) } // Index returns the ith component in the path func (p Path) Index(i int) *string { if p.Len() <= i { return nil } copy := []string(p)[i] return &copy } // Shift returns a new path that's shifted i positions to the left -- ith child of the head at index=0 func (p Path) Shift(i int) Path { len := p.Len() - i if len <= 0 { return Path([]string{}) } new := make([]string, len) copy(new, []string(p)[i:]) return Path(new) } // Dir returns the 'dir' of the path func (p Path) Dir() Path { pp := p.Clean() if len(pp) > 1 { return p[0 : len(pp)-1] } return Path([]string{"."}) } // Base returns the base of the path func (p Path) Base() string { pp := p.Clean() return pp[len(pp)-1] } // JoinString joins the input as a child of this path func (p Path) JoinString(child string) Path { return p.Join(Path([]string{child})) } // Join joins the child to the parent func (p Path) Join(child Path) Path { pp := p.Clean() this := []string(pp) if this[len(this)-1] == "" { pp = Path(this[:len(this)-1]) } return Path(append(pp, []string(child)...)).Clean() } // Rel returns a new path that is a child of the input from this path. // e.g. For a path a/b/c/d Rel(a/b/) returns c/d. NullPath is returned if // the two are not relative to one another. func (p Path) Rel(path Path) Path { if path.Equal(PathFromString(".")) { return p } this := []string(p.Clean()) parent := []string(path.Clean()) if parent[len(parent)-1] == "" { parent = parent[:len(parent)-1] } if len(this) < len(parent) { return NullPath } for i := 0; i < len(parent); i++ { if parent[i] != this[i] { return NullPath } } return Path(this[len(parent):]) } // Equal returns true if the path is lexicographically equal to the other func (p Path) Equal(other Path) bool { if len(p) != len(other) { return false } for i := 0; i < len(p); i++ { if p[i] != other[i] { return false } } return true } // Less return true if the path is lexicographically less than the other func (p Path) Less(other Path) bool { min := len(p) if len(other) < min { min = len(other) } for i := 0; i < min; i++ { if string(p[i]) != string(other[i]) { return string(p[i]) < string(other[i]) } } return len(p) < len(other) } // Paths is an alias for a slice of Path type Paths []Path func (p Paths) Len() int { return len(p) } func (p Paths) Less(i, j int) bool { return Path(p[i]).Less(Path(p[j])) } func (p Paths) Swap(i, j int) { p[i], p[j] = p[j], p[i] } // Sort sorts the paths. This will mutate the ordering of the paths in this slice. func (p *Paths) Sort() { sort.Sort(*p) } // SortPaths sorts the paths func SortPaths(p []Path) { sort.Sort(Paths(p)) } // MarshalJSON returns the json representation func (p Path) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf(`"%s"`, p.String())), nil } // UnmarshalJSON unmarshals the buffer to this struct func (p *Path) UnmarshalJSON(buff []byte) error { str := strings.Trim(string(buff), " \"\\'\t\n") *p = PathFromString(str) return nil }
pkg/types/path.go
0.688468
0.528473
path.go
starcoder
package forGraphBLASGo type scalarApply[Dt, Df any] struct { op UnaryOp[Dt, Df] s *scalarReference[Df] } func newScalarApply[Dt, Df any](op UnaryOp[Dt, Df], s *scalarReference[Df]) computeScalarT[Dt] { return scalarApply[Dt, Df]{op: op, s: s} } func (compute scalarApply[Dt, Df]) computeElement() (result Dt, ok bool) { if v, vok := compute.s.extractElement(); vok { return compute.op(v), true } return } type scalarApplyBinaryOp1st[Dt, Ds, Df any] struct { op BinaryOp[Dt, Ds, Df] value Ds s *scalarReference[Df] } func newScalarApplyBinaryOp1st[Dt, Ds, Df any](op BinaryOp[Dt, Ds, Df], value Ds, s *scalarReference[Df]) computeScalarT[Dt] { return scalarApplyBinaryOp1st[Dt, Ds, Df]{op: op, value: value, s: s} } func (compute scalarApplyBinaryOp1st[Dt, Ds, Df]) computeElement() (result Dt, ok bool) { if v, vok := compute.s.extractElement(); vok { return compute.op(compute.value, v), true } return } type scalarApplyBinaryOp2nd[Dt, Df, Ds any] struct { op BinaryOp[Dt, Df, Ds] s *scalarReference[Df] value Ds } func newScalarApplyBinaryOp2nd[Dt, Df, Ds any](op BinaryOp[Dt, Df, Ds], s *scalarReference[Df], value Ds) computeScalarT[Dt] { return scalarApplyBinaryOp2nd[Dt, Df, Ds]{op: op, s: s, value: value} } func (compute scalarApplyBinaryOp2nd[Dt, Df, Ds]) computeElement() (result Dt, ok bool) { if v, vok := compute.s.extractElement(); vok { return compute.op(v, compute.value), true } return } type scalarApplyBinary[Dt, Df1, Df2 any] struct { op BinaryOp[Dt, Df1, Df2] s1 *scalarReference[Df1] s2 *scalarReference[Df2] } func newScalarApplyBinary[Dt, Df1, Df2 any](op BinaryOp[Dt, Df1, Df2], s1 *scalarReference[Df1], s2 *scalarReference[Df2]) computeScalarT[Dt] { return scalarApplyBinary[Dt, Df1, Df2]{op: op, s1: s1, s2: s2} } func (compute scalarApplyBinary[Dt, Df1, Df2]) computeElement() (result Dt, ok bool) { if v1, v1ok := compute.s1.extractElement(); v1ok { if v2, v2ok := compute.s2.extractElement(); v2ok { return compute.op(v1, v2), true } } return }
functional_Scalar_ComputedApply.go
0.808483
0.659193
functional_Scalar_ComputedApply.go
starcoder
package collector import ( "time" "github.com/codragonzuo/beats/libbeat/common" ) // CounterCache keeps a cache of the last value of all given counters // and allows to calculate their rate since the last call. // All methods are thread-unsafe and must not be called concurrently type CounterCache interface { // Start the cache cleanup worker. It mus be called once before start using // the cache Start() // Stop the cache cleanup worker. It mus be called when the cache is disposed Stop() // RateUint64 returns, for a given counter name, the difference between the given value // and the value that was given in a previous call, and true if a previous value existed. // It will return 0 and false on the first call. RateUint64(counterName string, value uint64) (uint64, bool) // RateFloat64 returns, for a given counter name, the difference between the given value // and the value that was given in a previous call, and true if a previous value existed. // It will return 0 and false on the first call. RateFloat64(counterName string, value float64) (float64, bool) } type counterCache struct { ints *common.Cache floats *common.Cache timeout time.Duration } // NewCounterCache initializes and returns a CounterCache. The timeout parameter will be // used to automatically expire counters that hasn't been updated in a whole timeout period func NewCounterCache(timeout time.Duration) CounterCache { return &counterCache{ ints: common.NewCache(timeout, 0), floats: common.NewCache(timeout, 0), timeout: timeout, } } // RateUint64 returns, for a given counter name, the difference between the given value // and the value that was given in a previous call, and true if a previous value existed. // It will return 0 and false on the first call. func (c *counterCache) RateUint64(counterName string, value uint64) (uint64, bool) { prev := c.ints.PutWithTimeout(counterName, value, c.timeout) if prev != nil { if prev.(uint64) > value { // counter reset return 0, true } return value - prev.(uint64), true } // first put for this value, return rate of 0 return 0, false } // RateFloat64 returns, for a given counter name, the difference between the given value // and the value that was given in a previous call, and true if a previous value existed. // It will return 0 and false on the first call. func (c *counterCache) RateFloat64(counterName string, value float64) (float64, bool) { prev := c.floats.PutWithTimeout(counterName, value, c.timeout) if prev != nil { if prev.(float64) > value { // counter reset return 0, true } return value - prev.(float64), true } // first put for this value, return rate of 0 return 0, false } // Start the cache cleanup worker. It mus be called once before start using // the cache func (c *counterCache) Start() { c.ints.StartJanitor(c.timeout) c.floats.StartJanitor(c.timeout) } // Stop the cache cleanup worker. It mus be called when the cache is disposed func (c *counterCache) Stop() { c.ints.StopJanitor() c.floats.StopJanitor() }
x-pack/metricbeat/module/prometheus/collector/counter.go
0.731826
0.526343
counter.go
starcoder
// Copyright 2015, <NAME>, see LICENSE for details. // Copyright 2019, Minio, Inc. package reedsolomon import ( "sync" ) //go:noescape func _galMulAVX512Parallel81(in, out [][]byte, matrix *[matrixSize81]byte, addTo bool) //go:noescape func _galMulAVX512Parallel82(in, out [][]byte, matrix *[matrixSize82]byte, addTo bool) //go:noescape func _galMulAVX512Parallel84(in, out [][]byte, matrix *[matrixSize84]byte, addTo bool) const ( dimIn = 8 // Number of input rows processed simultaneously dimOut81 = 1 // Number of output rows processed simultaneously for x1 routine dimOut82 = 2 // Number of output rows processed simultaneously for x2 routine dimOut84 = 4 // Number of output rows processed simultaneously for x4 routine matrixSize81 = (16 + 16) * dimIn * dimOut81 // Dimension of slice of matrix coefficient passed into x1 routine matrixSize82 = (16 + 16) * dimIn * dimOut82 // Dimension of slice of matrix coefficient passed into x2 routine matrixSize84 = (16 + 16) * dimIn * dimOut84 // Dimension of slice of matrix coefficient passed into x4 routine ) // Construct block of matrix coefficients for single output row in parallel func setupMatrix81(matrixRows [][]byte, inputOffset, outputOffset int, matrix *[matrixSize81]byte) { offset := 0 for c := inputOffset; c < inputOffset+dimIn; c++ { for iRow := outputOffset; iRow < outputOffset+dimOut81; iRow++ { if c < len(matrixRows[iRow]) { coeff := matrixRows[iRow][c] copy(matrix[offset*32:], mulTableLow[coeff][:]) copy(matrix[offset*32+16:], mulTableHigh[coeff][:]) } else { // coefficients not used for this input shard (so null out) v := matrix[offset*32 : offset*32+32] for i := range v { v[i] = 0 } } offset += dimIn if offset >= dimIn*dimOut81 { offset -= dimIn*dimOut81 - 1 } } } } // Construct block of matrix coefficients for 2 output rows in parallel func setupMatrix82(matrixRows [][]byte, inputOffset, outputOffset int, matrix *[matrixSize82]byte) { offset := 0 for c := inputOffset; c < inputOffset+dimIn; c++ { for iRow := outputOffset; iRow < outputOffset+dimOut82; iRow++ { if c < len(matrixRows[iRow]) { coeff := matrixRows[iRow][c] copy(matrix[offset*32:], mulTableLow[coeff][:]) copy(matrix[offset*32+16:], mulTableHigh[coeff][:]) } else { // coefficients not used for this input shard (so null out) v := matrix[offset*32 : offset*32+32] for i := range v { v[i] = 0 } } offset += dimIn if offset >= dimIn*dimOut82 { offset -= dimIn*dimOut82 - 1 } } } } // Construct block of matrix coefficients for 4 output rows in parallel func setupMatrix84(matrixRows [][]byte, inputOffset, outputOffset int, matrix *[matrixSize84]byte) { offset := 0 for c := inputOffset; c < inputOffset+dimIn; c++ { for iRow := outputOffset; iRow < outputOffset+dimOut84; iRow++ { if c < len(matrixRows[iRow]) { coeff := matrixRows[iRow][c] copy(matrix[offset*32:], mulTableLow[coeff][:]) copy(matrix[offset*32+16:], mulTableHigh[coeff][:]) } else { // coefficients not used for this input shard (so null out) v := matrix[offset*32 : offset*32+32] for i := range v { v[i] = 0 } } offset += dimIn if offset >= dimIn*dimOut84 { offset -= dimIn*dimOut84 - 1 } } } } // Invoke AVX512 routine for single output row in parallel func galMulAVX512Parallel81(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset, start, stop int, matrix81 *[matrixSize81]byte) { done := stop - start if done <= 0 || len(in) == 0 || len(out) == 0 { return } inputEnd := inputOffset + dimIn if inputEnd > len(in) { inputEnd = len(in) } outputEnd := outputOffset + dimOut81 if outputEnd > len(out) { outputEnd = len(out) } // We know the max size, alloc temp array. var inTmp [dimIn][]byte for i, v := range in[inputOffset:inputEnd] { inTmp[i] = v[start:stop] } var outTmp [dimOut81][]byte for i, v := range out[outputOffset:outputEnd] { outTmp[i] = v[start:stop] } addTo := inputOffset != 0 // Except for the first input column, add to previous results _galMulAVX512Parallel81(inTmp[:inputEnd-inputOffset], outTmp[:outputEnd-outputOffset], matrix81, addTo) done = start + ((done >> 6) << 6) if done < stop { galMulAVX512LastInput(inputOffset, inputEnd, outputOffset, outputEnd, matrixRows, done, stop, out, in) } } // Invoke AVX512 routine for 2 output rows in parallel func galMulAVX512Parallel82(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset, start, stop int, matrix82 *[matrixSize82]byte) { done := stop - start if done <= 0 || len(in) == 0 || len(out) == 0 { return } inputEnd := inputOffset + dimIn if inputEnd > len(in) { inputEnd = len(in) } outputEnd := outputOffset + dimOut82 if outputEnd > len(out) { outputEnd = len(out) } // We know the max size, alloc temp array. var inTmp [dimIn][]byte for i, v := range in[inputOffset:inputEnd] { inTmp[i] = v[start:stop] } var outTmp [dimOut82][]byte for i, v := range out[outputOffset:outputEnd] { outTmp[i] = v[start:stop] } addTo := inputOffset != 0 // Except for the first input column, add to previous results _galMulAVX512Parallel82(inTmp[:inputEnd-inputOffset], outTmp[:outputEnd-outputOffset], matrix82, addTo) done = start + ((done >> 6) << 6) if done < stop { galMulAVX512LastInput(inputOffset, inputEnd, outputOffset, outputEnd, matrixRows, done, stop, out, in) } } // Invoke AVX512 routine for 4 output rows in parallel func galMulAVX512Parallel84(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset, start, stop int, matrix84 *[matrixSize84]byte) { done := stop - start if done <= 0 || len(in) == 0 || len(out) == 0 { return } inputEnd := inputOffset + dimIn if inputEnd > len(in) { inputEnd = len(in) } outputEnd := outputOffset + dimOut84 if outputEnd > len(out) { outputEnd = len(out) } // We know the max size, alloc temp array. var inTmp [dimIn][]byte for i, v := range in[inputOffset:inputEnd] { inTmp[i] = v[start:stop] } var outTmp [dimOut84][]byte for i, v := range out[outputOffset:outputEnd] { outTmp[i] = v[start:stop] } addTo := inputOffset != 0 // Except for the first input column, add to previous results _galMulAVX512Parallel84(inTmp[:inputEnd-inputOffset], outTmp[:outputEnd-outputOffset], matrix84, addTo) done = start + ((done >> 6) << 6) if done < stop { galMulAVX512LastInput(inputOffset, inputEnd, outputOffset, outputEnd, matrixRows, done, stop, out, in) } } func galMulAVX512LastInput(inputOffset int, inputEnd int, outputOffset int, outputEnd int, matrixRows [][]byte, done int, stop int, out [][]byte, in [][]byte) { for c := inputOffset; c < inputEnd; c++ { for iRow := outputOffset; iRow < outputEnd; iRow++ { if c < len(matrixRows[iRow]) { mt := mulTable[matrixRows[iRow][c]][:256] for i := done; i < stop; i++ { if c == 0 { // only set value for first input column out[iRow][i] = mt[in[c][i]] } else { // and add for all others out[iRow][i] ^= mt[in[c][i]] } } } } } } // Perform the same as codeSomeShards, but taking advantage of // AVX512 parallelism for up to 4x faster execution as compared to AVX2 func (r *reedSolomon) codeSomeShardsAvx512(matrixRows, inputs, outputs [][]byte, byteCount int) { // Process using no goroutines outputCount := len(outputs) start, end := 0, r.o.perRound if end > byteCount { end = byteCount } for start < byteCount { matrix84 := [matrixSize84]byte{} matrix82 := [matrixSize82]byte{} matrix81 := [matrixSize81]byte{} outputRow := 0 // First process (multiple) batches of 4 output rows in parallel if outputRow+dimOut84 <= outputCount { for ; outputRow+dimOut84 <= outputCount; outputRow += dimOut84 { for inputRow := 0; inputRow < len(inputs); inputRow += dimIn { setupMatrix84(matrixRows, inputRow, outputRow, &matrix84) galMulAVX512Parallel84(inputs, outputs, matrixRows, inputRow, outputRow, start, end, &matrix84) } } } // Then process a (single) batch of 2 output rows in parallel if outputRow+dimOut82 <= outputCount { for inputRow := 0; inputRow < len(inputs); inputRow += dimIn { setupMatrix82(matrixRows, inputRow, outputRow, &matrix82) galMulAVX512Parallel82(inputs, outputs, matrixRows, inputRow, outputRow, start, end, &matrix82) } outputRow += dimOut82 } // Lastly, we may have a single output row left (for uneven parity) if outputRow < outputCount { for inputRow := 0; inputRow < len(inputs); inputRow += dimIn { setupMatrix81(matrixRows, inputRow, outputRow, &matrix81) galMulAVX512Parallel81(inputs, outputs, matrixRows, inputRow, outputRow, start, end, &matrix81) } } start = end end += r.o.perRound if end > byteCount { end = byteCount } } } // Perform the same as codeSomeShards, but taking advantage of // AVX512 parallelism for up to 4x faster execution as compared to AVX2 func (r *reedSolomon) codeSomeShardsAvx512P(matrixRows, inputs, outputs [][]byte, byteCount int) { outputCount := len(outputs) var wg sync.WaitGroup do := byteCount / r.o.maxGoroutines if do < r.o.minSplitSize { do = r.o.minSplitSize } // Make sizes divisible by 64 do = (do + 63) & (^63) start := 0 for start < byteCount { if start+do > byteCount { do = byteCount - start } wg.Add(1) go func(grStart, grStop int) { start, stop := grStart, grStart+r.o.perRound if stop > grStop { stop = grStop } // Loop for each round. matrix84 := [matrixSize84]byte{} matrix82 := [matrixSize82]byte{} matrix81 := [matrixSize81]byte{} for start < grStop { outputRow := 0 // First process (multiple) batches of 4 output rows in parallel if outputRow+dimOut84 <= outputCount { // 1K matrix buffer for ; outputRow+dimOut84 <= outputCount; outputRow += dimOut84 { for inputRow := 0; inputRow < len(inputs); inputRow += dimIn { setupMatrix84(matrixRows, inputRow, outputRow, &matrix84) galMulAVX512Parallel84(inputs, outputs, matrixRows, inputRow, outputRow, start, stop, &matrix84) } } } // Then process a (single) batch of 2 output rows in parallel if outputRow+dimOut82 <= outputCount { // 512B matrix buffer for inputRow := 0; inputRow < len(inputs); inputRow += dimIn { setupMatrix82(matrixRows, inputRow, outputRow, &matrix82) galMulAVX512Parallel82(inputs, outputs, matrixRows, inputRow, outputRow, start, stop, &matrix82) } outputRow += dimOut82 } // Lastly, we may have a single output row left (for uneven parity) if outputRow < outputCount { for inputRow := 0; inputRow < len(inputs); inputRow += dimIn { setupMatrix81(matrixRows, inputRow, outputRow, &matrix81) galMulAVX512Parallel81(inputs, outputs, matrixRows, inputRow, outputRow, start, stop, &matrix81) } } start = stop stop += r.o.perRound if stop > grStop { stop = grStop } } wg.Done() }(start, start+do) start += do } wg.Wait() }
galoisAvx512_amd64.go
0.59408
0.531088
galoisAvx512_amd64.go
starcoder
package reticulum import ( "errors" layers "github.com/eliquious/reticulum/layers" volume "github.com/eliquious/reticulum/volume" ) const ( // DefaultDropout is the default dropout rate of 0.5 or 50%. Everything less than the dropout rate will be dropped. DefaultDropout float64 = 0.5 ) // Network is the neural network interface. type Network interface { Size() int Layers() []layers.Layer Forward(vol *volume.Volume, training bool) *volume.Volume Backward(index int) float64 GetCostLoss(vol *volume.Volume, index int) float64 // GetPrediction assumes the last layer in the network is a SoftMax layer. GetPrediction() int GetResponse() []layers.LayerResponse MultiDimensionalLoss(losses []float64) float64 DimensionalLoss(index int, value float64) float64 } // NewNetwork creates a new network from the layer definitions func NewNetwork(defs []layers.LayerDef) (Network, error) { if len(defs) <= 2 { return nil, errors.New("at least one input and one loss layer are required") } else if defs[0].Type != layers.Input { return nil, errors.New("first layer must be the input layer, to declare size of inputs") } // Add activation layers defs = layers.ActivateLayers(defs) var newLayers []layers.Layer for i, def := range defs { if i > 0 { prev := defs[i-1] def.Input = prev.Output } switch def.Type { case layers.FullyConnected: newLayers = append(newLayers, layers.NewFullyConnectedLayer(def)) case layers.Dropout: newLayers = append(newLayers, layers.NewDropoutLayer(def)) case layers.Input: newLayers = append(newLayers, layers.NewInputLayer(def)) case layers.SoftMax: newLayers = append(newLayers, layers.NewSoftmaxLayer(def)) case layers.Regression: newLayers = append(newLayers, layers.NewRegressionLayer(def)) case layers.Conv: newLayers = append(newLayers, layers.NewConvLayer(def)) case layers.Pool: newLayers = append(newLayers, layers.NewPoolLayer(def)) case layers.ReLU: newLayers = append(newLayers, layers.NewReluLayer(def)) case layers.Sigmoid: newLayers = append(newLayers, layers.NewSigmoidLayer(def)) case layers.Tanh: newLayers = append(newLayers, layers.NewTanhLayer(def)) case layers.Maxout: newLayers = append(newLayers, layers.NewMaxoutLayer(def)) case layers.SVM: newLayers = append(newLayers, layers.NewSVMLayer(def)) // case layers.LocalResponseNorm: default: return nil, errors.New("unrecognized layer type") } } return &network{newLayers}, nil } type network struct { layers []layers.Layer } func (n *network) Size() int { return len(n.layers) } func (n *network) Layers() []layers.Layer { return n.layers } func (n *network) Forward(vol *volume.Volume, training bool) *volume.Volume { actions := n.layers[0].Forward(vol, training) for index := 1; index < len(n.layers); index++ { actions = n.layers[index].Forward(vol, training) } return actions } func (n *network) Backward(index int) float64 { size := n.Size() // Calculate loss lossLayer, ok := n.layers[size-1].(layers.LossLayer) if !ok { panic("expecting loss layer as last layer in network") } loss := lossLayer.Loss(index) // Propogate backwards for index := n.Size() - 2; index >= 0; index-- { n.layers[index].Backward() } return loss } func (n *network) GetCostLoss(vol *volume.Volume, index int) float64 { n.Forward(vol, false) // Calculate loss lossLayer, ok := n.layers[n.Size()-1].(layers.LossLayer) if !ok { panic("expecting loss layer as last layer in network") } return lossLayer.Loss(index) } func (n *network) GetPrediction() int { // this is a convenience function for returning the argmax // prediction, assuming the last layer of the net is a softmax S := n.layers[n.Size()-1] if S.Type() != layers.SoftMax { panic("GetPrediction assumes Softmax is the last layer in the network") } return layers.GetSoftMaxPrediction(S) } func (n *network) GetResponse() []layers.LayerResponse { // accumulate parameters and gradients for the entire network resp := []layers.LayerResponse{} for index := 0; index < len(n.layers); index++ { layerResponse := n.layers[index].GetResponse() resp = append(resp, layerResponse...) } return resp } // MultiDimensionalLoss computes the total loss for each of the values given. func (n *network) MultiDimensionalLoss(y []float64) float64 { lossLayer, ok := n.layers[n.Size()-1].(layers.RegressionLossLayer) if !ok { panic("MultiDimensionalLoss assumes a Regression layer is the last layer in the network") } return lossLayer.MultiDimensionalLoss(y) } func (n *network) DimensionalLoss(index int, value float64) float64 { lossLayer, ok := n.layers[n.Size()-1].(layers.RegressionLossLayer) if !ok { panic("DimensionalLoss assumes a Regression layer is the last layer in the network") } return lossLayer.DimensionalLoss(index, value) }
net.go
0.82887
0.460289
net.go
starcoder
package datapb import ( "reflect" "fmt" ) func ToDataHash(h map[string]reflect.Value) (*DataHash, error) { cnt := len(h) els := make([]*DataEntry, 0, cnt) for k, v := range h { dev, err := ToData(v) if err != nil { return nil, err } els = append(els, &DataEntry{k, dev}) } return &DataHash{els}, nil } func ToData(v reflect.Value) (*Data, error) { if !v.IsValid() { return &Data{Kind: &Data_UndefValue{}}, nil } switch v.Kind() { case reflect.Bool: return &Data{Kind: &Data_BooleanValue{v.Bool()}}, nil case reflect.Float32, reflect.Float64: return &Data{Kind: &Data_FloatValue{v.Float()}}, nil case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return &Data{Kind: &Data_IntegerValue{v.Int()}}, nil case reflect.String: return &Data{Kind: &Data_StringValue{v.String()}}, nil case reflect.Slice, reflect.Array: cnt := v.Len() els := make([]*Data, cnt) for i := 0; i < cnt; i++ { elem, err := ToData(v.Index(i)) if err != nil { return nil, err } els[i] = elem } return &Data{Kind: &Data_ArrayValue{&DataArray{els}}}, nil case reflect.Map: keys := v.MapKeys() hash := make(map[string]reflect.Value, len(keys)) for _, k := range keys { if !(k.IsValid() && k.Kind() == reflect.String) { return nil, fmt.Errorf(`expected hash key to be 'string', got '%s'`, k.Type()) } hash[k.String()] = v.MapIndex(k) } dh, err := ToDataHash(hash) if err != nil { return nil, err } return &Data{Kind: &Data_HashValue{dh}}, nil case reflect.Struct: if v.Type().String() == `reflect.Value` { return ToData(v.Interface().(reflect.Value)) } case reflect.Interface: if v.Type() == interfaceType && v.Interface() == nil { // The interface{} nil value represents a generic nil return &Data{Kind: &Data_UndefValue{}}, nil } return ToData(v.Elem()); } return nil, fmt.Errorf(`unable to convert a value of kind '%s' and type '%s' to Data`, v.Kind(), v.Type().Name()) } var interfaceType = reflect.TypeOf([]interface{}{}).Elem() var stringType = reflect.TypeOf(``) var GenericNilValue = reflect.Zero(interfaceType) var InvalidValue = reflect.ValueOf(nil) func FromDataHash(h *DataHash) (map[string]reflect.Value, error) { av := h.Entries hash := make(map[string]reflect.Value, len(av)) for _, elem := range av { rv, err := FromData(elem.Value) if err != nil { return nil, err } hash[elem.Key] = rv } return hash, nil } func FromData(v *Data) (reflect.Value, error) { if v.Kind == nil { return GenericNilValue, nil } switch v.Kind.(type) { case *Data_BooleanValue: return reflect.ValueOf(v.GetBooleanValue()), nil case *Data_FloatValue: return reflect.ValueOf(v.GetFloatValue()), nil case *Data_IntegerValue: return reflect.ValueOf(v.GetIntegerValue()), nil case *Data_StringValue: return reflect.ValueOf(v.GetStringValue()), nil case *Data_UndefValue: return GenericNilValue, nil case *Data_ArrayValue: av := v.GetArrayValue().GetValues() vals := make([]reflect.Value, len(av)) var et reflect.Type = nil for i, elem := range av { rv, err := FromData(elem) if err != nil { return InvalidValue, err } rt := rv.Type() if et == nil { et = rt } else if et != rt { et = nil } vals[i] = rv } if et == nil { et = interfaceType } return reflect.Append(reflect.MakeSlice(reflect.SliceOf(et), 0, len(vals)), vals...), nil case *Data_HashValue: av := v.GetHashValue().Entries vals := make([]reflect.Value, len(av)) keys := make([]reflect.Value, len(av)) var et reflect.Type = nil for i, elem := range av { keys[i] = reflect.ValueOf(elem.Key) rv, err := FromData(elem.Value) if err != nil { return InvalidValue, err } vals[i] = rv rt := rv.Type() if et == nil { et = rt } else if et != rt { et = nil } } if et == nil { et = interfaceType } hash := reflect.MakeMapWithSize(reflect.MapOf(stringType, et), len(vals)) for i, k := range keys { hash.SetMapIndex(k, vals[i]) } return hash, nil default: return InvalidValue, fmt.Errorf(`unable to convert a value of type '%T' to reflect.Value`, v.Kind) } }
datapb/reflect.go
0.510008
0.42316
reflect.go
starcoder
package fnv1 const ( // FNV-1 offset64 = uint64(14695981039346656037) prime64 = uint64(1099511628211) // Init64 is what 64 bits hash values should be initialized with. Init64 = offset64 ) // HashString64 returns the hash of s. func HashString64(s string) uint64 { return AddString64(Init64, s) } // HashBytes64 returns the hash of u. func HashBytes64(b []byte) uint64 { return AddBytes64(Init64, b) } // HashUint64 returns the hash of u. func HashUint64(u uint64) uint64 { return AddUint64(Init64, u) } // AddString64 adds the hash of s to the precomputed hash value h. func AddString64(h uint64, s string) uint64 { for len(s) >= 8 { h = (h * prime64) ^ uint64(s[0]) h = (h * prime64) ^ uint64(s[1]) h = (h * prime64) ^ uint64(s[2]) h = (h * prime64) ^ uint64(s[3]) h = (h * prime64) ^ uint64(s[4]) h = (h * prime64) ^ uint64(s[5]) h = (h * prime64) ^ uint64(s[6]) h = (h * prime64) ^ uint64(s[7]) s = s[8:] } if len(s) >= 4 { h = (h * prime64) ^ uint64(s[0]) h = (h * prime64) ^ uint64(s[1]) h = (h * prime64) ^ uint64(s[2]) h = (h * prime64) ^ uint64(s[3]) s = s[4:] } if len(s) >= 2 { h = (h * prime64) ^ uint64(s[0]) h = (h * prime64) ^ uint64(s[1]) s = s[2:] } if len(s) > 0 { h = (h * prime64) ^ uint64(s[0]) } return h } // AddBytes64 adds the hash of b to the precomputed hash value h. func AddBytes64(h uint64, b []byte) uint64 { for len(b) >= 8 { h = (h * prime64) ^ uint64(b[0]) h = (h * prime64) ^ uint64(b[1]) h = (h * prime64) ^ uint64(b[2]) h = (h * prime64) ^ uint64(b[3]) h = (h * prime64) ^ uint64(b[4]) h = (h * prime64) ^ uint64(b[5]) h = (h * prime64) ^ uint64(b[6]) h = (h * prime64) ^ uint64(b[7]) b = b[8:] } if len(b) >= 4 { h = (h * prime64) ^ uint64(b[0]) h = (h * prime64) ^ uint64(b[1]) h = (h * prime64) ^ uint64(b[2]) h = (h * prime64) ^ uint64(b[3]) b = b[4:] } if len(b) >= 2 { h = (h * prime64) ^ uint64(b[0]) h = (h * prime64) ^ uint64(b[1]) b = b[2:] } if len(b) > 0 { h = (h * prime64) ^ uint64(b[0]) } return h } // AddUint64 adds the hash value of the 8 bytes of u to h. func AddUint64(h uint64, u uint64) uint64 { h = (h * prime64) ^ ((u >> 56) & 0xFF) h = (h * prime64) ^ ((u >> 48) & 0xFF) h = (h * prime64) ^ ((u >> 40) & 0xFF) h = (h * prime64) ^ ((u >> 32) & 0xFF) h = (h * prime64) ^ ((u >> 24) & 0xFF) h = (h * prime64) ^ ((u >> 16) & 0xFF) h = (h * prime64) ^ ((u >> 8) & 0xFF) h = (h * prime64) ^ ((u >> 0) & 0xFF) return h }
vendor/github.com/segmentio/fasthash/fnv1/hash.go
0.705379
0.427217
hash.go
starcoder
package main import ( "bufio" "fmt" "math" "os" "strconv" ) type cardinalDir int const ( north cardinalDir = iota east south west ) type position struct { x int y int } type waypoint struct { pos position facing cardinalDir } type ship struct { pos position wp waypoint } func (wp *waypoint) move(dir cardinalDir, units int) { switch dir { case north: wp.pos.y += units case east: wp.pos.x += units case south: wp.pos.y -= units case west: wp.pos.x -= units } } func (s *ship) sail(times int) { diff := position{s.wp.pos.x - s.pos.x, s.wp.pos.y - s.pos.y} newFerryPos := position{s.pos.x + diff.x*times, s.pos.y + diff.y*times} newWpPos := position{newFerryPos.x + diff.x, newFerryPos.y + diff.y} s.pos = newFerryPos s.wp.pos = newWpPos } func (s *ship) rotateWaypoint(clockwise bool, degrees int) { // Translate waypoint so its relative to the point of origin // essentially, pretend the ship went back to (0,0) and adjust the waypoint accordingly rotationPoint := position{s.wp.pos.x - s.pos.x, s.wp.pos.y - s.pos.y} // convert degrees to radians since that's what the math lib uses angle := float64(degrees) * math.Pi / 180 fsin, fcos := math.Sincos(angle) // can safely convert these to int now since the provided degrees will only give values of -1, 0 and 1 sin := int(fsin) cos := int(fcos) // formula for rotating a point around the origin. // Save the x value for use in the calculation of y' temp := rotationPoint.x if clockwise { rotationPoint.x = rotationPoint.x*cos + rotationPoint.y*sin rotationPoint.y = rotationPoint.y*cos - temp*sin } else { rotationPoint.x = rotationPoint.x*cos - rotationPoint.y*sin rotationPoint.y = rotationPoint.y*cos + temp*sin } // translate the waypoint back so its relative to the ships coords s.wp.pos = position{s.pos.x + rotationPoint.x, s.pos.y + rotationPoint.y} } func abs(x int) int { if x < 0 { return -x } return x } func main() { if len(os.Args) != 2 { fmt.Println("Usage: go run pt1.go <input_file>") os.Exit(1) } fileName := os.Args[1] file, err := os.Open(fileName) if err != nil { fmt.Println(err) os.Exit(1) } // ferry always starts at (0,0) ferryPos := position{0, 0} // waypoiny starts 10 units east and 1 unit north of the ferry wpPos := position{10, 1} wp := waypoint{wpPos, east} ferry := ship{ferryPos, wp} lineNo := 0 scanner := bufio.NewScanner(file) fmt.Println(ferry) for scanner.Scan() { line := scanner.Text() // Each line is a single character for an action followed by an integer for units to move (or degrees if L or R) action := line[0] units, ok := strconv.Atoi(line[1:]) if ok != nil { fmt.Printf("expected integer unit on line %d", lineNo) os.Exit(1) } switch action { case 'F': ferry.sail(units) case 'L': ferry.rotateWaypoint(false, units) case 'R': ferry.rotateWaypoint(true, units) case 'N': ferry.wp.move(north, units) case 'E': ferry.wp.move(east, units) case 'S': ferry.wp.move(south, units) case 'W': ferry.wp.move(west, units) default: fmt.Println("unexpected action on line", lineNo) os.Exit(1) } lineNo++ } manhattanDist := abs(ferry.pos.x) + abs(ferry.pos.y) fmt.Printf("Manhattan distance is %d after sailing to (%d,%d)\n", manhattanDist, ferry.pos.x, ferry.pos.y) }
day12/pt2.go
0.587707
0.474814
pt2.go
starcoder
package iris16 import "fmt" const ( // Compare operations CompareOpEq = iota CompareOpEqAnd CompareOpEqOr CompareOpEqXor CompareOpNeq CompareOpNeqAnd CompareOpNeqOr CompareOpNeqXor CompareOpLessThan CompareOpLessThanAnd CompareOpLessThanOr CompareOpLessThanXor CompareOpGreaterThan CompareOpGreaterThanAnd CompareOpGreaterThanOr CompareOpGreaterThanXor CompareOpLessThanOrEqualTo CompareOpLessThanOrEqualToAnd CompareOpLessThanOrEqualToOr CompareOpLessThanOrEqualToXor CompareOpGreaterThanOrEqualTo CompareOpGreaterThanOrEqualToAnd CompareOpGreaterThanOrEqualToOr CompareOpGreaterThanOrEqualToXor CompareOpCount ) func init() { if CompareOpCount > 32 { panic("Too many compare operations defined!") } } type compareOpCombine func(bool, bool) (bool, error) const ( CombineNone = iota CombineAnd CombineOr CombineXor CombineError ) var combineOps = []compareOpCombine{ func(_, n bool) (bool, error) { return n, nil }, func(o, n bool) (bool, error) { return o && n, nil }, func(o, n bool) (bool, error) { return o || n, nil }, func(o, n bool) (bool, error) { return o != n, nil }, func(_, _ bool) (bool, error) { return false, fmt.Errorf("invalid combine operation!") }, } const ( CompareBodyEq = iota CompareBodyNeq CompareBodyLt CompareBodyGt CompareBodyLe CompareBodyGe CompareBodyError ) type compareOpBody func(Word, Word) (bool, error) var bodyOps = []compareOpBody{ func(a, b Word) (bool, error) { return a == b, nil }, func(a, b Word) (bool, error) { return a != b, nil }, func(a, b Word) (bool, error) { return a < b, nil }, func(a, b Word) (bool, error) { return a > b, nil }, func(a, b Word) (bool, error) { return a <= b, nil }, func(a, b Word) (bool, error) { return a >= b, nil }, func(a, b Word) (bool, error) { return false, fmt.Errorf("Invalid compare body op!") }, } type compareOp struct { Body, Combine int // record the index } var errorCompareOp = compareOp{Body: CompareBodyError, Combine: CombineError} func (this *compareOp) Invoke(oldVal bool, new0, new1 Word) (bool, error) { if result, err := bodyOps[this.Body](new0, new1); err != nil { return false, err } else { return combineOps[this.Combine](oldVal, result) } } var compareOps = [32]compareOp{ {CompareBodyEq, CombineNone}, {CompareBodyEq, CombineAnd}, {CompareBodyEq, CombineOr}, {CompareBodyEq, CombineXor}, {CompareBodyNeq, CombineNone}, {CompareBodyNeq, CombineAnd}, {CompareBodyNeq, CombineOr}, {CompareBodyNeq, CombineXor}, {CompareBodyLt, CombineNone}, {CompareBodyLt, CombineAnd}, {CompareBodyLt, CombineOr}, {CompareBodyLt, CombineXor}, {CompareBodyGt, CombineNone}, {CompareBodyGt, CombineAnd}, {CompareBodyGt, CombineOr}, {CompareBodyGt, CombineXor}, {CompareBodyLe, CombineNone}, {CompareBodyLe, CombineAnd}, {CompareBodyLe, CombineOr}, {CompareBodyLe, CombineXor}, {CompareBodyGe, CombineNone}, {CompareBodyGe, CombineAnd}, {CompareBodyGe, CombineOr}, {CompareBodyGe, CombineXor}, errorCompareOp, errorCompareOp, errorCompareOp, errorCompareOp, errorCompareOp, errorCompareOp, errorCompareOp, errorCompareOp, } func boolToWord(val bool) Word { if val { return 1 } else { return 0 } } func compare(core *Core, inst *DecodedInstruction) error { if val, err := compareOps[inst.Op].Invoke(core.PredicateValue(inst.Data[0]), core.Register(inst.Data[1]), core.Register(inst.Data[2])); err != nil { return err } else { return core.SetRegister(inst.Data[0], boolToWord(val)) } }
iris16/compare.go
0.547222
0.467757
compare.go
starcoder
package scalar import ( "fmt" "reflect" "time" "unsafe" "github.com/apache/arrow/go/arrow" "golang.org/x/xerrors" ) type op int8 const ( convDIVIDE = iota convMULTIPLY ) var timestampConversion = [...][4]struct { op op factor int64 }{ arrow.Nanosecond: { arrow.Nanosecond: {convMULTIPLY, int64(time.Nanosecond)}, arrow.Microsecond: {convDIVIDE, int64(time.Microsecond)}, arrow.Millisecond: {convDIVIDE, int64(time.Millisecond)}, arrow.Second: {convDIVIDE, int64(time.Second)}, }, arrow.Microsecond: { arrow.Nanosecond: {convMULTIPLY, int64(time.Microsecond)}, arrow.Microsecond: {convMULTIPLY, 1}, arrow.Millisecond: {convDIVIDE, int64(time.Millisecond / time.Microsecond)}, arrow.Second: {convDIVIDE, int64(time.Second / time.Microsecond)}, }, arrow.Millisecond: { arrow.Nanosecond: {convMULTIPLY, int64(time.Millisecond)}, arrow.Microsecond: {convMULTIPLY, int64(time.Millisecond / time.Microsecond)}, arrow.Millisecond: {convMULTIPLY, 1}, arrow.Second: {convDIVIDE, int64(time.Second / time.Millisecond)}, }, arrow.Second: { arrow.Nanosecond: {convMULTIPLY, int64(time.Second)}, arrow.Microsecond: {convMULTIPLY, int64(time.Second / time.Microsecond)}, arrow.Millisecond: {convMULTIPLY, int64(time.Second / time.Millisecond)}, arrow.Second: {convMULTIPLY, 1}, }, } func ConvertTimestampValue(in, out arrow.TimeUnit, value int64) int64 { conv := timestampConversion[int(in)][int(out)] switch conv.op { case convMULTIPLY: return value * conv.factor case convDIVIDE: return value / conv.factor } return 0 } func temporalToString(s TemporalScalar) string { switch s := s.(type) { case *Date32: return time.Unix(0, 0).UTC().AddDate(0, 0, int(s.Value)).Format("2006-01-02") case *Date64: days := int(int64(s.Value) / (time.Hour * 24).Milliseconds()) return time.Unix(0, 0).UTC().AddDate(0, 0, days).Format("2006-01-02") case *Duration: return fmt.Sprint(time.Duration(s.Value) * s.Unit().Multiplier()) case *Time32: return time.Unix(0, int64(s.Value)*int64(s.Unit().Multiplier())).UTC().Format("15:04:05.999") case *Time64: return time.Unix(0, int64(s.Value)*int64(s.Unit().Multiplier())).UTC().Format("15:04:05.999999999") case *Timestamp: return time.Unix(0, int64(s.Value)*int64(s.Unit().Multiplier())).UTC().Format("2006-01-02 15:04:05.999999999") } return "..." } type TemporalScalar interface { Scalar temporal() } type Duration struct { scalar Value arrow.Duration } func (Duration) temporal() {} func (s *Duration) value() interface{} { return s.Value } func (s *Duration) CastTo(to arrow.DataType) (Scalar, error) { return castTemporal(s, to) } func (s *Duration) String() string { if !s.Valid { return "null" } val, err := s.CastTo(arrow.BinaryTypes.String) if err != nil { return "..." } return string(val.(*String).Value.Bytes()) } func (s *Duration) equals(rhs Scalar) bool { return s.Value == rhs.(*Duration).Value } func (s *Duration) Unit() arrow.TimeUnit { return s.DataType().(*arrow.TimestampType).Unit } func (s *Duration) Data() []byte { return (*[arrow.DurationSizeBytes]byte)(unsafe.Pointer(&s.Value))[:] } func NewDurationScalar(val arrow.Duration, typ arrow.DataType) *Duration { return &Duration{scalar{typ, true}, val} } type DateScalar interface { TemporalScalar date() } type TimeScalar interface { TemporalScalar Unit() arrow.TimeUnit time() } type IntervalScalar interface { TemporalScalar interval() } const millisecondsInDay = (time.Hour * 24) / time.Millisecond func castTemporal(from TemporalScalar, to arrow.DataType) (Scalar, error) { if arrow.TypeEqual(from.DataType(), to) { return from, nil } if !from.IsValid() { return MakeNullScalar(to), nil } if r, ok := numericMap[to.ID()]; ok { return convertToNumeric(reflect.ValueOf(from.value()), r.valueType, r.scalarFunc), nil } if to.ID() == arrow.STRING { return NewStringScalar(temporalToString(from)), nil } switch s := from.(type) { case DateScalar: if to.ID() == arrow.TIMESTAMP { var newValue int64 switch s := s.(type) { case *Date32: newValue = int64(s.Value) * int64(millisecondsInDay) case *Date64: newValue = int64(s.Value) } return NewTimestampScalar(arrow.Timestamp(ConvertTimestampValue(arrow.Millisecond, to.(*arrow.TimestampType).Unit, newValue)), to), nil } switch s := s.(type) { case *Date32: if to.ID() == arrow.DATE64 { return NewDate64Scalar(arrow.Date64(s.Value) * arrow.Date64(millisecondsInDay)), nil } case *Date64: if to.ID() == arrow.DATE32 { return NewDate32Scalar(arrow.Date32(s.Value / arrow.Date64(millisecondsInDay))), nil } } case *Timestamp: switch to := to.(type) { case *arrow.TimestampType: return NewTimestampScalar(arrow.Timestamp(ConvertTimestampValue(s.Unit(), to.Unit, int64(s.Value))), to), nil case *arrow.Date32Type: millis := ConvertTimestampValue(s.Unit(), arrow.Millisecond, int64(s.Value)) return NewDate32Scalar(arrow.Date32(millis / int64(millisecondsInDay))), nil case *arrow.Date64Type: millis := ConvertTimestampValue(s.Unit(), arrow.Millisecond, int64(s.Value)) return NewDate64Scalar(arrow.Date64(millis - millis%int64(millisecondsInDay))), nil } case TimeScalar: switch to := to.(type) { case *arrow.Time32Type: return NewTime32Scalar(arrow.Time32(ConvertTimestampValue(s.Unit(), to.Unit, int64(s.value().(arrow.Time64)))), to), nil case *arrow.Time64Type: return NewTime64Scalar(arrow.Time64(ConvertTimestampValue(s.Unit(), to.Unit, int64(s.value().(arrow.Time32)))), to), nil } case *Duration: switch to := to.(type) { case *arrow.StringType: case *arrow.DurationType: return NewDurationScalar(arrow.Duration(ConvertTimestampValue(s.Unit(), to.Unit, int64(s.Value))), to), nil } } return nil, xerrors.Errorf("") } type Date32 struct { scalar Value arrow.Date32 } func (Date32) temporal() {} func (Date32) date() {} func (s *Date32) value() interface{} { return s.Value } func (s *Date32) Data() []byte { return (*[arrow.Date32SizeBytes]byte)(unsafe.Pointer(&s.Value))[:] } func (s *Date32) equals(rhs Scalar) bool { return s.Value == rhs.(*Date32).Value } func (s *Date32) CastTo(to arrow.DataType) (Scalar, error) { return castTemporal(s, to) } func (s *Date32) String() string { if !s.Valid { return "null" } val, err := s.CastTo(arrow.BinaryTypes.String) if err != nil { return "..." } return string(val.(*String).Value.Bytes()) } func NewDate32Scalar(val arrow.Date32) *Date32 { return &Date32{scalar{arrow.FixedWidthTypes.Date32, true}, val} } type Date64 struct { scalar Value arrow.Date64 } func (Date64) temporal() {} func (Date64) date() {} func (s *Date64) value() interface{} { return s.Value } func (s *Date64) CastTo(to arrow.DataType) (Scalar, error) { return castTemporal(s, to) } func (s *Date64) Data() []byte { return (*[arrow.Date64SizeBytes]byte)(unsafe.Pointer(&s.Value))[:] } func (s *Date64) equals(rhs Scalar) bool { return s.Value == rhs.(*Date64).Value } func (s *Date64) String() string { if !s.Valid { return "null" } val, err := s.CastTo(arrow.BinaryTypes.String) if err != nil { return "..." } return string(val.(*String).Value.Bytes()) } func NewDate64Scalar(val arrow.Date64) *Date64 { return &Date64{scalar{arrow.FixedWidthTypes.Date64, true}, val} } type Time32 struct { scalar Value arrow.Time32 } func (Time32) temporal() {} func (Time32) time() {} func (s *Time32) value() interface{} { return s.Value } func (s *Time32) CastTo(to arrow.DataType) (Scalar, error) { return castTemporal(s, to) } func (s *Time32) Unit() arrow.TimeUnit { return s.DataType().(*arrow.Time32Type).Unit } func (s *Time32) equals(rhs Scalar) bool { return s.Value == rhs.(*Time32).Value } func (s *Time32) String() string { if !s.Valid { return "null" } val, err := s.CastTo(arrow.BinaryTypes.String) if err != nil { return "..." } return string(val.(*String).Value.Bytes()) } func (s *Time32) Data() []byte { return (*[arrow.Time32SizeBytes]byte)(unsafe.Pointer(&s.Value))[:] } func NewTime32Scalar(val arrow.Time32, typ arrow.DataType) *Time32 { return &Time32{scalar{typ, true}, val} } type Time64 struct { scalar Value arrow.Time64 } func (Time64) temporal() {} func (Time64) time() {} func (s *Time64) value() interface{} { return s.Value } func (s *Time64) CastTo(to arrow.DataType) (Scalar, error) { return castTemporal(s, to) } func (s *Time64) Unit() arrow.TimeUnit { return s.DataType().(*arrow.Time64Type).Unit } func (s *Time64) Data() []byte { return (*[arrow.Time64SizeBytes]byte)(unsafe.Pointer(&s.Value))[:] } func (s *Time64) equals(rhs Scalar) bool { return s.Value == rhs.(*Time64).Value } func (s *Time64) String() string { if !s.Valid { return "null" } val, err := s.CastTo(arrow.BinaryTypes.String) if err != nil { return "..." } return string(val.(*String).Value.Bytes()) } func NewTime64Scalar(val arrow.Time64, typ arrow.DataType) *Time64 { return &Time64{scalar{typ, true}, val} } type Timestamp struct { scalar Value arrow.Timestamp } func (Timestamp) temporal() {} func (Timestamp) time() {} func (s *Timestamp) value() interface{} { return s.Value } func (s *Timestamp) CastTo(to arrow.DataType) (Scalar, error) { return castTemporal(s, to) } func (s *Timestamp) Unit() arrow.TimeUnit { return s.DataType().(*arrow.TimestampType).Unit } func (s *Timestamp) Data() []byte { return (*[arrow.TimestampSizeBytes]byte)(unsafe.Pointer(&s.Value))[:] } func (s *Timestamp) equals(rhs Scalar) bool { return s.Value == rhs.(*Timestamp).Value } func (s *Timestamp) String() string { if !s.Valid { return "null" } val, err := s.CastTo(arrow.BinaryTypes.String) if err != nil { return "..." } return string(val.(*String).Value.Bytes()) } func NewTimestampScalar(val arrow.Timestamp, typ arrow.DataType) *Timestamp { return &Timestamp{scalar{typ, true}, val} } type MonthInterval struct { scalar Value arrow.MonthInterval } func (MonthInterval) temporal() {} func (MonthInterval) interval() {} func (s *MonthInterval) value() interface{} { return s.Value } func (s *MonthInterval) CastTo(to arrow.DataType) (Scalar, error) { if !s.Valid { return MakeNullScalar(to), nil } if !arrow.TypeEqual(s.DataType(), to) { return nil, xerrors.Errorf("non-null monthinterval scalar cannot be cast to anything other than monthinterval") } return s, nil } func (s *MonthInterval) String() string { if !s.Valid { return "null" } val, err := s.CastTo(arrow.BinaryTypes.String) if err != nil { return "..." } return string(val.(*String).Value.Bytes()) } func (s *MonthInterval) equals(rhs Scalar) bool { return s.Value == rhs.(*MonthInterval).Value } func (s *MonthInterval) Data() []byte { return (*[arrow.MonthIntervalSizeBytes]byte)(unsafe.Pointer(&s.Value))[:] } func NewMonthIntervalScalar(val arrow.MonthInterval) *MonthInterval { return &MonthInterval{scalar{arrow.FixedWidthTypes.MonthInterval, true}, val} } type DayTimeInterval struct { scalar Value arrow.DayTimeInterval } func (DayTimeInterval) temporal() {} func (DayTimeInterval) interval() {} func (s *DayTimeInterval) value() interface{} { return s.Value } func (s *DayTimeInterval) Data() []byte { return (*[arrow.DayTimeIntervalSizeBytes]byte)(unsafe.Pointer(&s.Value))[:] } func (s *DayTimeInterval) String() string { if !s.Valid { return "null" } val, err := s.CastTo(arrow.BinaryTypes.String) if err != nil { return "..." } return string(val.(*String).Value.Bytes()) } func (s *DayTimeInterval) CastTo(to arrow.DataType) (Scalar, error) { if !s.Valid { return MakeNullScalar(to), nil } if !arrow.TypeEqual(s.DataType(), to) { return nil, xerrors.Errorf("non-null daytimeinterval scalar cannot be cast to anything other than monthinterval") } return s, nil } func (s *DayTimeInterval) equals(rhs Scalar) bool { return s.Value == rhs.(*DayTimeInterval).Value } func NewDayTimeIntervalScalar(val arrow.DayTimeInterval) *DayTimeInterval { return &DayTimeInterval{scalar{arrow.FixedWidthTypes.DayTimeInterval, true}, val} } type MonthDayNanoInterval struct { scalar Value arrow.MonthDayNanoInterval } func (MonthDayNanoInterval) temporal() {} func (MonthDayNanoInterval) interval() {} func (s *MonthDayNanoInterval) value() interface{} { return s.Value } func (s *MonthDayNanoInterval) Data() []byte { return (*[arrow.MonthDayNanoIntervalSizeBytes]byte)(unsafe.Pointer(&s.Value))[:] } func (s *MonthDayNanoInterval) String() string { if !s.Valid { return "null" } val, err := s.CastTo(arrow.BinaryTypes.String) if err != nil { return "..." } return string(val.(*String).Value.Bytes()) } func (s *MonthDayNanoInterval) CastTo(to arrow.DataType) (Scalar, error) { if !s.Valid { return MakeNullScalar(to), nil } if !arrow.TypeEqual(s.DataType(), to) { return nil, xerrors.Errorf("non-null month_day_nano_interval scalar cannot be cast to anything other than monthinterval") } return s, nil } func (s *MonthDayNanoInterval) equals(rhs Scalar) bool { return s.Value == rhs.(*MonthDayNanoInterval).Value } func NewMonthDayNanoIntervalScalar(val arrow.MonthDayNanoInterval) *MonthDayNanoInterval { return &MonthDayNanoInterval{scalar{arrow.FixedWidthTypes.MonthDayNanoInterval, true}, val} } var ( _ Scalar = (*Date32)(nil) )
go/arrow/scalar/temporal.go
0.808937
0.402744
temporal.go
starcoder
package treap import "math/rand" type KeyT int64 const ( maxKey = KeyT(0x7fffffffffffffff) minKey = -maxKey - 1 ) type node struct { key KeyT left, right *node prio uint } type Treap struct { rng *rand.Rand root *node } func New() *Treap { var t Treap t.Init() return &t } func (t *Treap) Init() { t.root = nil t.rng = rand.New(rand.NewSource(1)) } func (t *Treap) newNode(k KeyT) *node { return &node{key: k, left: nil, right: nil, prio: uint(t.rng.Int())} } func (t *Treap) Insert(k KeyT) { t.root = t.insert(t.root, k) } func (t *Treap) insert(x *node, k KeyT) *node { if x == nil { return t.newNode(k) } if k <= x.key { x.left = t.insert(x.left, k) if x.left.prio < x.prio { x = rotateRight(x) } } else { x.right = t.insert(x.right, k) if x.right.prio < x.prio { x = rotateLeft(x) } } return x } func (t *Treap) Delete(k KeyT) { var p *node = nil x := t.root for x != nil && x.key != k { p = x if k < x.key { x = x.left } else { x = x.right } } switch { case x == nil: return case p == nil: t.root = t.down(x) case x == p.left: p.left = t.down(x) default: // x == p.right p.right = t.down(x) } } func rotateLeft(x *node) *node { y := x.right x.right = y.left y.left = x return y } func rotateRight(y *node) *node { x := y.left y.left = x.right x.right = y return x } func (t *Treap) down(x *node) *node { var y *node switch { case x.left == nil: return x.right case x.right == nil: return x.left case x.left.prio < x.right.prio: y = rotateRight(x) y.right = t.down(x) default: y = rotateLeft(x) y.left = t.down(x) } return y } func (t *Treap) verifyBSTProperty() bool { return verifyBSTProperty(t.root, minKey, maxKey) } func verifyBSTProperty(p *node, low, high KeyT) bool { if p == nil { return true } if p.key < low || p.key > high { return false } return verifyBSTProperty(p.left, low, p.key) && verifyBSTProperty(p.right, p.key+1, high) } func (t *Treap) verifyHeapProperty() bool { return verifyHeapProperty(t.root) } func verifyHeapProperty(x *node) bool { if x == nil { return true } if !verifyHeapProperty(x.left) || !verifyHeapProperty(x.right) { return false } if x.left != nil && x.left.prio < x.prio { return false } if x.right != nil && x.right.prio < x.prio { return false } return true } func (t *Treap) height() uint { return height(t.root) } func max(a, b uint) uint { if a > b { return a } else { return b } } func height(x *node) uint { if x == nil { return 0 } else { return 1 + max(height(x.left), height(x.right)) } }
Chapter 13-4- Treaps/src/treap/treap.go
0.641422
0.464841
treap.go
starcoder
// Package diff implements a linewise diff algorithm. package diff import ( "bytes" "fmt" "strings" ) // Chunk represents a piece of the diff. A chunk will not have both added and // deleted lines. Equal lines are always after any added or deleted lines. // A Chunk may or may not have any lines in it, especially for the first or last // chunk in a computation. type Chunk struct { Added []string Deleted []string Equal []string } // Diff returns a string containing a line-by-line unified diff of the linewise // changes required to make A into B. Each line is prefixed with '+', '-', or // ' ' to indicate if it should be added, removed, or is correct respectively. func Diff(A, B string) string { aLines := strings.Split(A, "\n") bLines := strings.Split(B, "\n") chunks := DiffChunks(aLines, bLines) buf := new(bytes.Buffer) for _, c := range chunks { for _, line := range c.Added { fmt.Fprintf(buf, "+%s\n", line) } for _, line := range c.Deleted { fmt.Fprintf(buf, "-%s\n", line) } for _, line := range c.Equal { fmt.Fprintf(buf, " %s\n", line) } } return strings.TrimRight(buf.String(), "\n") } // DiffChunks uses an O(D(N+M)) shortest-edit-script algorithm // to compute the edits required from A to B and returns the // edit chunks. func DiffChunks(A, B []string) []Chunk { // algorithm: http://www.xmailserver.org/diff2.pdf N, M := len(A), len(B) MAX := N + M V := make([]int, 2*MAX+1) Vs := make([][]int, 0, 8) var D int dLoop: for D = 0; D <= MAX; D++ { for k := -D; k <= D; k += 2 { var x int if k == -D || (k != D && V[MAX+k-1] < V[MAX+k+1]) { x = V[MAX+k+1] } else { x = V[MAX+k-1] + 1 } y := x - k for x < N && y < M && A[x] == B[y] { x++ y++ } V[MAX+k] = x if x >= N && y >= M { Vs = append(Vs, append(make([]int, 0, len(V)), V...)) break dLoop } } Vs = append(Vs, append(make([]int, 0, len(V)), V...)) } if D == 0 { return nil } chunks := make([]Chunk, D+1) x, y := N, M for d := D; d > 0; d-- { V := Vs[d] k := x - y insert := k == -d || (k != d && V[MAX+k-1] < V[MAX+k+1]) x1 := V[MAX+k] var x0, xM, kk int if insert { kk = k + 1 x0 = V[MAX+kk] xM = x0 } else { kk = k - 1 x0 = V[MAX+kk] xM = x0 + 1 } y0 := x0 - kk var c Chunk if insert { c.Added = B[y0:][:1] } else { c.Deleted = A[x0:][:1] } if xM < x1 { c.Equal = A[xM:][:x1-xM] } x, y = x0, y0 chunks[d] = c } if x > 0 { chunks[0].Equal = A[:x] } return chunks }
vendor/github.com/kylelemons/godebug/diff/diff.go
0.702938
0.459197
diff.go
starcoder
package graph import ( "fmt" "reflect" "github.com/mariomac/pipes/pkg/graph/stage" "github.com/mariomac/pipes/pkg/node" ) type codecKey struct { In reflect.Type Out reflect.Type } type outTyper interface { OutType() reflect.Type } type inTyper interface { InType() reflect.Type } type inOutTyper interface { inTyper outTyper } // Builder helps to build a graph and to connect their nodes. It takes care of instantiating all // its stages given a name and a type, as well as connect them. If two connected stages have // incompatible types, it will insert a codec in between to translate between the stage types type Builder struct { startProviders map[reflect.Type][2]reflect.Value //0: reflect.ValueOf(node.AsStart[I, O]), 1: reflect.ValueOf(startfunc) middleProviders map[reflect.Type][2]reflect.Value terminalProviders map[reflect.Type][2]reflect.Value // keys: instance IDs ingests map[string]outTyper transforms map[string]inOutTyper exports map[string]inTyper connects map[string][]string codecs map[codecKey][2]reflect.Value // 0: reflect.ValueOf(node.AsMiddle[I,O]), 1: reflect.ValueOf(middleFunc[I, O]) options []reflect.Value } // NewBuilder instantiates a Graph Builder with the default configuration, which can be overridden via the // arguments. func NewBuilder(options ...node.Option) *Builder { optVals := make([]reflect.Value, 0, len(options)) for _, opt := range options { optVals = append(optVals, reflect.ValueOf(opt)) } return &Builder{ codecs: map[codecKey][2]reflect.Value{}, startProviders: map[reflect.Type][2]reflect.Value{}, // stage.StartProvider middleProviders: map[reflect.Type][2]reflect.Value{}, // stage.MiddleProvider{}, terminalProviders: map[reflect.Type][2]reflect.Value{}, // stage.TerminalProvider{}, ingests: map[string]outTyper{}, // *node.Start transforms: map[string]inOutTyper{}, // *node.Middle exports: map[string]inTyper{}, // *node.Terminal connects: map[string][]string{}, options: optVals, } } // RegisterCodec registers a Codec into the graph builder. A Codec is a node.MiddleFunc function // that allows converting data types and it's automatically inserted when a node with a given // output type is connected to a node with a different input type. When nodes with different // types are connected, a codec converting between both MUST have been registered previously. // Otherwise the graph Build method will fail. func RegisterCodec[I, O any](nb *Builder, middleFunc node.MiddleFunc[I, O]) { var in I var out O // temporary middle node used only to check input/output types nb.codecs[codecKey{In: reflect.TypeOf(in), Out: reflect.TypeOf(out)}] = [2]reflect.Value{ reflect.ValueOf(node.AsMiddle[I, O]), reflect.ValueOf(middleFunc), } } // RegisterStart registers a stage.StartProvider into the graph builder. When the Build // method is invoked later, any configuration field associated with the StartProvider will // result in the instantiation of a node.Start with the provider's returned function. func RegisterStart[CFG stage.Instancer, O any](nb *Builder, b stage.StartProvider[CFG, O]) { nb.startProviders[typeOf[CFG]()] = [2]reflect.Value{ reflect.ValueOf(node.AsStart[O]), reflect.ValueOf(b), } } // RegisterMiddle registers a stage.MiddleProvider into the graph builder. When the Build // method is invoked later, any configuration field associated with the MiddleProvider will // result in the instantiation of a node.Middle with the provider's returned function. func RegisterMiddle[CFG stage.Instancer, I, O any](nb *Builder, b stage.MiddleProvider[CFG, I, O]) { nb.middleProviders[typeOf[CFG]()] = [2]reflect.Value{ reflect.ValueOf(node.AsMiddle[I, O]), reflect.ValueOf(b), } } // RegisterTerminal registers a stage.TerminalProvider into the graph builder. When the Build // method is invoked later, any configuration field associated with the TerminalProvider will // result in the instantiation of a node.Terminal with the provider's returned function. func RegisterTerminal[CFG stage.Instancer, I any](nb *Builder, b stage.TerminalProvider[CFG, I]) { nb.terminalProviders[typeOf[CFG]()] = [2]reflect.Value{ reflect.ValueOf(node.AsTerminal[I]), reflect.ValueOf(b), } } // Build creates a Graph where each node corresponds to a field in the passed Configuration struct. // The nodes will be connected according to the ConnectedConfig "source" --> ["destination"...] map. func (b *Builder) Build(cfg ConnectedConfig) (Graph, error) { g := Graph{} if err := b.applyConfig(cfg); err != nil { return g, err } for _, i := range b.ingests { g.start = append(g.start, i.(startNode)) } for _, e := range b.exports { g.terms = append(g.terms, e.(terminalNode)) } return g, nil } func instantiate(nb *Builder, instanceID string, arg reflect.Value) error { // TODO: check if instanceID is duplicate if instanceID == "" { return fmt.Errorf("instance ID for type %s can't be empty", arg.Type()) } rargs := []reflect.Value{arg} if ib, ok := nb.startProviders[arg.Type()]; ok { // providedFunc = StartProvider(arg) providedFunc := ib[1].Call(rargs) // startNode = AsStart(providedFunc, nb.options...) startNode := ib[0].Call(providedFunc) nb.ingests[instanceID] = startNode[0].Interface().(outTyper) return nil } if tb, ok := nb.middleProviders[arg.Type()]; ok { // providedFunc = MiddleProvider(arg) providedFunc := tb[1].Call(rargs) // middleNode = AsMiddle(providedFunc, nb.options...) middleNode := tb[0].Call(append(providedFunc, nb.options...)) nb.transforms[instanceID] = middleNode[0].Interface().(inOutTyper) return nil } if eb, ok := nb.terminalProviders[arg.Type()]; ok { // providedFunc = TerminalProvider(arg) providedFunc := eb[1].Call(rargs) // termNode = AsTerminal(providedFunc, nb.options...) termNode := eb[0].Call(append(providedFunc, nb.options...)) nb.exports[instanceID] = termNode[0].Interface().(inTyper) return nil } return fmt.Errorf("unknown node name %q for type %q", instanceID, arg.Type()) } func (b *Builder) connect(src, dst string) error { // find source and destination stages var srcNode outTyper var ok bool srcNode, ok = b.ingests[src] if !ok { srcNode, ok = b.transforms[src] if !ok { return fmt.Errorf("invalid source node: %q", src) } } var dstNode inTyper dstNode, ok = b.transforms[dst] if !ok { dstNode, ok = b.exports[dst] if !ok { return fmt.Errorf("invalid destination node: %q", dst) } } srcSendsToMethod := reflect.ValueOf(srcNode).MethodByName("SendsTo") if srcSendsToMethod.IsZero() { panic(fmt.Sprintf("BUG: for stage %q, source of type %T does not have SendsTo method", src, srcNode)) } // check if they have compatible types if srcNode.OutType() == dstNode.InType() { srcSendsToMethod.Call([]reflect.Value{reflect.ValueOf(dstNode)}) return nil } // otherwise, we will add in intermediate codec layer codec, ok := b.newCodec(srcNode.OutType(), dstNode.InType()) if !ok { return fmt.Errorf("can't connect %q and %q stages because there isn't registered"+ " any %s -> %s codec", src, dst, srcNode.OutType(), dstNode.InType()) } srcSendsToMethod.Call([]reflect.Value{codec}) codecSendsToMethod := codec.MethodByName("SendsTo") if codecSendsToMethod.IsZero() { panic(fmt.Sprintf("BUG: for stage %q, codec of type %T does not have SendsTo method", src, srcNode)) } codecSendsToMethod.Call([]reflect.Value{reflect.ValueOf(dstNode)}) return nil } // returns a node.Midle[?, ?] as a value func (b *Builder) newCodec(inType, outType reflect.Type) (reflect.Value, bool) { codec, ok := b.codecs[codecKey{In: inType, Out: outType}] if !ok { return reflect.ValueOf(nil), false } result := codec[0].Call(codec[1:]) return result[0], true } func typeOf[T any]() reflect.Type { var t T return reflect.TypeOf(t) }
pkg/graph/builder.go
0.598899
0.512815
builder.go
starcoder
package gobang import ( "fmt" "strings" ) func NewBoard(size *Size) *Board { cells := make([]*Cell, size.CellCount()) for i := range cells { y := (i / size.Width) x := i - (y * size.Width) cells[i] = &Cell{NewPoint(x, y), 0} } return &Board{ Size: size, Cells: cells, } } type Board struct { *Size `json:"size"` Cells []*Cell `json:"cells"` } func (board *Board) SelectCell(point Point2D) *Cell { index := (point.Y() * board.Width()) + point.X() return board.Cells[index] } func (board *Board) SelectCells(matcher CellMatcher) []*Cell { point := DefaultPoint() endX := board.Width() - 1 endY := board.Height() - 1 cells := make([]*Cell, 0) for x := 0; x <= endX; x++ { for y := 0; y <= endY; y++ { cell := board.SelectCell(point.SetTo(x, y)) if !matcher.Matches(cell) { continue } cells = append(cells, cell) } } return cells } func (board *Board) HaveCell(point Point2D) bool { isXRange := point.X() >= 0 && point.X() <= board.Width()-1 isYRange := point.Y() >= 0 && point.Y() <= board.Height()-1 return isXRange && isYRange } func (board *Board) Height() int { return board.Size.Height } func (board *Board) Width() int { return board.Size.Width } func (board *Board) IsCellEmpty(point Point2D) bool { cell := board.SelectCell(point) return cell.IsEmpty() } func (board *Board) IsAllFilled() bool { point := DefaultPoint() endX := board.Width() - 1 endY := board.Height() - 1 for x := 0; x <= endX; x++ { for y := 0; y <= endY; y++ { if !board.IsCellEmpty(point.SetTo(x, y)) { continue } return false } } return true } func (board *Board) Print() { point := DefaultPoint() cells := make([]string, 0) for y := 0; y <= board.Height()-1; y++ { for x := 0; x <= board.Width()-1; x++ { cell := board.SelectCell(point.SetTo(x, y)) if cell.IsEmpty() { cells = append(cells, " ") } else { cells = append(cells, cell.Stone.String()) } } fmt.Println("|" + strings.Join(cells, "|") + "|") cells = cells[0:0] } }
gobang/board.go
0.660501
0.431105
board.go
starcoder
package x52 import ( "fmt" ) // String returns a string representation of the LED func (led LED) String() string { switch led { case LedFire: return "Fire" case LedA: return "A" case LedB: return "B" case LedD: return "D" case LedE: return "E" case LedT1: return "T1" case LedT2: return "T2" case LedT3: return "T3" case LedPOV: return "POV" case LedClutch: return "Clutch" case LedThrottle: return "Throttle" } return fmt.Sprintf("LED(%d)", led) } // String returns a string representation of the LED state func (state LedState) String() string { switch state { case LedOff: return "Off" case LedOn: return "On" case LedRed: return "Red" case LedAmber: return "Amber" case LedGreen: return "Green" } return fmt.Sprintf("State(%d)", state) } // SetLed sets the state of the given LED. Not all LEDs support all states, // LedFire and LedThrottle only support LedOn and LedOff states, // the remaining LEDs support every state except LedOn. // **Limitation**: This function will not work on a non-pro X52 at this time. func (ctx *Context) SetLed(led LED, state LedState) error { // Make sure that this is a supported device // The non-pro X52 doesn't support setting LED states if !ctx.HasFeature(FeatureLED) { return errNotSupported("setting LED state") } switch led { case LedFire, LedThrottle: if state == LedOff { bitClear(&ctx.ledMask, uint32(led)) bitSet(&ctx.updateMask, uint32(led)) } else if state == LedOn { bitSet(&ctx.ledMask, uint32(led)) bitSet(&ctx.updateMask, uint32(led)) } else { return errNotSupported("invalid state for on/off LED") } case LedA, LedB, LedD, LedE, LedT1, LedT2, LedT3, LedPOV, LedClutch: ledID := uint32(led) switch state { case LedOff: bitClear(&ctx.ledMask, ledID+0) bitClear(&ctx.ledMask, ledID+1) case LedRed: bitSet(&ctx.ledMask, ledID+0) bitClear(&ctx.ledMask, ledID+1) case LedAmber: bitSet(&ctx.ledMask, ledID+0) bitSet(&ctx.ledMask, ledID+1) case LedGreen: bitClear(&ctx.ledMask, ledID+0) bitSet(&ctx.ledMask, ledID+1) default: return errNotSupported("invalid state for color LED") } bitSet(&ctx.updateMask, ledID+0) bitSet(&ctx.updateMask, ledID+1) default: return errNotSupported("invalid LED identifier") } return nil }
x52/led.go
0.789153
0.512937
led.go
starcoder
package hexgridgeo import ( "math" hexgrid "github.com/gojuno/go.hexgrid" morton "github.com/gojuno/go.morton" ) type Point struct { lon float64 lat float64 } type Projection interface { GeoToPoint(geoPoint Point) hexgrid.Point PointToGeo(point hexgrid.Point) Point } type projectionNoOp struct { } type projectionSin struct { } type projectionAEP struct { } type projectionSM struct { } var ProjectionNoOp = projectionNoOp{} var ProjectionSin = projectionSin{} var ProjectionAEP = projectionAEP{} var ProjectionSM = projectionSM{} var OrientationPointy = hexgrid.OrientationPointy var OrientationFlat = hexgrid.OrientationFlat type Grid struct { hexgrid *hexgrid.Grid projection Projection } const earthCircumference = 40075016.685578488 const earthMetersPerDegree = 111319.49079327358 func MakePoint(lon float64, lat float64) Point { return Point{lon: lon, lat: lat} } func (point Point) Lon() float64 { return point.lon } func (point Point) Lat() float64 { return point.lat } func (projectionNoOp) GeoToPoint(geoPoint Point) hexgrid.Point { return hexgrid.MakePoint(geoPoint.Lon(), geoPoint.Lat()) } func (projectionNoOp) PointToGeo(point hexgrid.Point) Point { return MakePoint(point.X(), point.Y()) } func (projectionSin) GeoToPoint(geoPoint Point) hexgrid.Point { λ := (geoPoint.Lon() + 180) * (math.Pi / 180) φ := geoPoint.Lat() * (math.Pi / 180) x := (λ * math.Cos(φ)) * ((earthCircumference / 2) / math.Pi) y := φ * ((earthCircumference / 2) / math.Pi) return hexgrid.MakePoint(x, y) } func (projectionSin) PointToGeo(point hexgrid.Point) Point { φ := point.Y() / ((earthCircumference / 2) / math.Pi) λ := point.X() / (math.Cos(φ) * ((earthCircumference / 2) / math.Pi)) lon := (λ / (math.Pi / 180)) - 180 lat := φ / (math.Pi / 180) return MakePoint(lon, lat) } func (projectionAEP) GeoToPoint(geoPoint Point) hexgrid.Point { θ := geoPoint.Lon() * (math.Pi / 180) ρ := math.Pi/2 - (geoPoint.Lat() * (math.Pi / 180)) x := ρ * math.Sin(θ) y := -ρ * math.Cos(θ) return hexgrid.MakePoint(x, y) } func (projectionAEP) PointToGeo(point hexgrid.Point) Point { θ := math.Atan2(point.X(), -point.Y()) ρ := point.X() / math.Sin(θ) lat := (math.Pi/2 - ρ) / (math.Pi / 180) lon := θ / (math.Pi / 180) return MakePoint(lon, lat) } func (projectionSM) GeoToPoint(geoPoint Point) hexgrid.Point { latR := geoPoint.Lat() * (math.Pi / 180) x := geoPoint.Lon() * earthMetersPerDegree y := math.Log(math.Tan(latR) + (1 / math.Cos(latR))) y = (y / math.Pi) * (earthCircumference / 2) return hexgrid.MakePoint(x, y) } func (projectionSM) PointToGeo(point hexgrid.Point) Point { lon := point.X() / earthMetersPerDegree lat := math.Asin(math.Tanh((point.Y() / (earthCircumference / 2)) * math.Pi)) lat = lat * (180 / math.Pi) return MakePoint(lon, lat) } func MakeGrid(orientation hexgrid.Orientation, size float64, projection Projection) *Grid { return &Grid{ hexgrid: hexgrid.MakeGrid(orientation, hexgrid.MakePoint(0, 0), hexgrid.MakePoint(size, size), morton.Make64(2, 32)), projection: projection} } func (grid *Grid) HexToCode(hex hexgrid.Hex) int64 { return grid.hexgrid.HexToCode(hex) } func (grid *Grid) HexFromCode(code int64) hexgrid.Hex { return grid.hexgrid.HexFromCode(code) } func (grid *Grid) HexAt(geoPoint Point) hexgrid.Hex { return grid.hexgrid.HexAt(grid.projection.GeoToPoint(geoPoint)) } func (grid *Grid) HexCenter(hex hexgrid.Hex) Point { return grid.projection.PointToGeo(grid.hexgrid.HexCenter(hex)) } func (grid *Grid) HexCorners(hex hexgrid.Hex) [6]Point { var geoCorners [6]Point corners := grid.hexgrid.HexCorners(hex) for i := 0; i < 6; i++ { geoCorners[i] = grid.projection.PointToGeo(corners[i]) } return geoCorners } func (grid *Grid) HexNeighbors(hex hexgrid.Hex, layers int64) []hexgrid.Hex { return grid.hexgrid.HexNeighbors(hex, layers) } func (grid *Grid) MakeRegionFromMultiPolygon(geometry [][]Point) *hexgrid.Region { points := make([][]hexgrid.Point, len(geometry)) for g := 0; g < len(geometry); g++ { points[g] = make([]hexgrid.Point, len(geometry[g])) for i := 0; i < len(geometry[g]); i++ { points[g][i] = grid.projection.GeoToPoint(geometry[g][i]) } } return grid.hexgrid.MakeRegionFromMultiPolygon(points) } func (grid *Grid) MakeRegion(geometry []Point) *hexgrid.Region { mgeometry := make([][]Point, 1) mgeometry[0] = geometry return grid.MakeRegionFromMultiPolygon(mgeometry) }
hexgridgeo.go
0.80784
0.575737
hexgridgeo.go
starcoder
package resolv import ( "math" "sort" ) // Line represents a line, from one point to another. type Line struct { BasicShape X2, Y2 float64 } // NewLine returns a new Line instance. func NewLine(x, y, x2, y2 float64) *Line { l := &Line{} l.X = x l.Y = y l.X2 = x2 l.Y2 = y2 return l } // BUG(SolarLune): Line.IsColliding() and Line.GetIntersectionPoints() doesn't work with Circles. // BUG(SolarLune): Line.IsColliding() and Line.GetIntersectionPoints() fail if testing two lines that intersect along the exact same slope. // IsColliding returns if the Line is colliding with the other Shape. Currently, Circle-Line collision is missing. func (l *Line) IsColliding(other Shape) bool { intersectionPoints := l.GetIntersectionPoints(other) colliding := len(intersectionPoints) > 0 r, ok := other.(*Rectangle) if ok && !colliding { return (l.X >= r.X && l.Y >= r.Y && l.X < r.X+r.W && l.Y < r.Y+r.H) || (l.X2 >= r.X && l.Y2 >= r.Y && l.X2 < r.X+r.W && l.Y2 < r.Y+r.H) } return colliding } // IntersectionPoint represents a point of intersection from a Line with another Shape. type IntersectionPoint struct { X, Y float64 Shape Shape } // GetIntersectionPoints returns the intersection points of a Line with another Shape as an array of IntersectionPoints. // The returned list of intersection points are always sorted in order of distance from the start of the casting Line to each intersection. // Currently, Circle-Line collision is missing. func (l *Line) GetIntersectionPoints(other Shape) []IntersectionPoint { intersections := []IntersectionPoint{} switch b := other.(type) { case *Line: det := (l.X2-l.X)*(b.Y2-b.Y) - (b.X2-b.X)*(l.Y2-l.Y) if det != 0 { // MAGIC MATH; the extra + 1 here makes it so that corner cases (literally aiming the line through the corners of the // hollow square in world5) works! lambda := (((l.Y - b.Y) * (b.X2 - b.X)) - ((l.X - b.X) * (b.Y2 - b.Y)) + 1) / det gamma := (((l.Y - b.Y) * (l.X2 - l.X)) - ((l.X - b.X) * (l.Y2 - l.Y)) + 1) / det if (0 < lambda && lambda < 1) && (0 < gamma && gamma < 1) { dx, dy := l.GetDelta() intersections = append(intersections, IntersectionPoint{l.X + lambda*dx, l.Y + lambda*dy, other}) } } case *Rectangle: side := NewLine(b.X, b.Y, b.X, b.Y+b.H) intersections = append(intersections, l.GetIntersectionPoints(side)...) side.Y = b.Y + b.H side.X2 = b.X + b.W side.Y2 = b.Y + b.H intersections = append(intersections, l.GetIntersectionPoints(side)...) side.X = b.X + b.W side.Y2 = b.Y intersections = append(intersections, l.GetIntersectionPoints(side)...) side.Y = b.Y side.X2 = b.X side.Y2 = b.Y intersections = append(intersections, l.GetIntersectionPoints(side)...) case *Space: for _, shape := range *b { intersections = append(intersections, l.GetIntersectionPoints(shape)...) } case *Circle: // TO-DO: Add this later, because this is kinda hard and would necessitate some complex vector math that, for whatever // reason, is not even readily available in a Golang library as far as I can tell??? break } // fmt.Println("WARNING! Object ", other, " isn't a valid shape for collision testing against Line ", l, "!") sort.Slice(intersections, func(i, j int) bool { return Distance(l.X, l.Y, intersections[i].X, intersections[i].Y) < Distance(l.X, l.Y, intersections[j].X, intersections[j].Y) }) return intersections } // WouldBeColliding returns if the Line would be colliding if it were moved by the designated delta X and Y values. func (l *Line) WouldBeColliding(other Shape, dx, dy float64) bool { l.X += dx l.Y += dy l.X2 += dx l.Y2 += dy isColliding := l.IsColliding(other) l.X -= dx l.Y -= dy l.X2 -= dx l.Y2 -= dy return isColliding } // SetXY sets the position of the Line, also moving the end point of the line (so it wholly moves the line to the // specified position). func (l *Line) SetXY(x, y float64) { dx := x - l.X dy := y - l.Y l.X = x l.Y = y l.X2 += dx l.Y2 += dy } // Move moves the Line by the values specified. func (l *Line) Move(x, y float64) { l.X += x l.Y += y l.X2 += x l.Y2 += y } // Center returns the center X and Y values of the Line. func (l *Line) Center() (float64, float64) { x := l.X + ((l.X2 - l.X) / 2) y := l.Y + ((l.Y2 - l.Y) / 2) return x, y } // GetLength returns the length of the Line. func (l *Line) GetLength() float64 { return Distance(l.X, l.Y, l.X2, l.Y2) } // SetLength sets the length of the Line to the value provided. func (l *Line) SetLength(length float64) { ln := l.GetLength() xd := l.X2 - l.X/ln*length yd := l.Y2 - l.Y/ln*length l.X2 = l.X + xd l.Y2 = l.Y + yd } // GetBoundingRectangle returns a rectangle centered on the center point of the Line that would fully contain the Line. func (l *Line) GetBoundingRectangle() *Rectangle { w := math.Abs(l.X2 - l.X) h := math.Abs(l.Y2 - l.Y) x := l.X if l.X2 < l.X { x = l.X2 } y := l.Y if l.Y2 < l.Y { y = l.Y2 } return NewRectangle(x, y, w, h) } // GetBoundingCircle returns a circle centered on the Line's central point that would fully contain the Line. func (l *Line) GetBoundingCircle() *Circle { x, y := l.Center() radius := math.Abs(l.X2 - l.X) r2 := math.Abs(l.Y2 - l.Y) if r2 > radius { radius = r2 } return NewCircle(x, y, radius/2) } // GetDelta returns the delta (or difference) between the start and end point of a Line. func (l *Line) GetDelta() (float64, float64) { dx := l.X2 - l.X dy := l.Y2 - l.Y return dx, dy }
resolv/line.go
0.843122
0.543469
line.go
starcoder