@@ -78,43 +78,43 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
7878
7979 //Private IPv4 functions
8080 private func initCIDRTab( ) {
81- for bits in ( 1 ... 30 ) {
81+ for bits in ( 1 ... 32 ) {
8282 supernetMaskBitsCombo. addItem ( withObjectValue: String ( bits) )
8383 }
8484
85- for index in ( 2 ... 31 ) . reversed ( ) {
85+ for index in ( 0 ... 31 ) . reversed ( ) {
8686 supernetMaskCombo. addItem ( withObjectValue: IPSubnetCalc . digitize ( ipAddress: ( IPSubnetCalc . Constants. addr32Full << index) ) )
8787 }
88- for index in ( 0 ... 29 ) {
88+ for index in ( 0 ... 31 ) {
8989 supernetMaxCombo. addItem ( withObjectValue: NSDecimalNumber ( decimal: pow ( 2 , index) ) . stringValue)
9090 }
9191 for index in ( 1 ... 31 ) {
9292 supernetMaxAddr. addItem ( withObjectValue: NSDecimalNumber ( decimal: ( pow ( 2 , index) - 2 ) ) . stringValue)
9393 }
94- for index in ( 0 ... 31 ) {
94+ for index in ( 0 ... 32 ) {
9595 supernetMaxSubnetsCombo. addItem ( withObjectValue: NSDecimalNumber ( decimal: pow ( 2 , index) ) . stringValue)
9696 }
9797 }
9898
9999 private func initSubnetsTab( ) {
100- for index in ( 2 ... 24 ) . reversed ( ) {
100+ for index in ( 0 ... 24 ) . reversed ( ) {
101101 if ( wildcard. state == NSControl . StateValue. on) {
102102 subnetMaskCombo. addItem ( withObjectValue: IPSubnetCalc . digitize ( ipAddress: ~ ( IPSubnetCalc . Constants. addr32Full << index) ) )
103103 }
104104 else {
105105 subnetMaskCombo. addItem ( withObjectValue: IPSubnetCalc . digitize ( ipAddress: ( IPSubnetCalc . Constants. addr32Full << index) ) )
106106 }
107107 }
108- for bits in ( 8 ... 30 ) {
108+ for bits in ( 8 ... 32 ) {
109109 maskBitsCombo. addItem ( withObjectValue: String ( bits) )
110110 }
111- for bits in ( 0 ... 22 ) {
111+ for bits in ( 0 ... 24 ) {
112112 subnetBitsCombo. addItem ( withObjectValue: String ( bits) )
113113 }
114- for index in ( 2 ... 24 ) {
114+ for index in ( 1 ... 24 ) {
115115 maxHostsBySubnetCombo. addItem ( withObjectValue: NSDecimalNumber ( decimal: ( pow ( 2 , index) - 2 ) ) . stringValue)
116116 }
117- for index in ( 0 ... 22 ) {
117+ for index in ( 0 ... 24 ) {
118118 maxSubnetsCombo. addItem ( withObjectValue: NSDecimalNumber ( decimal: pow ( 2 , index) ) . stringValue)
119119 }
120120 classBitMap. stringValue = " nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh "
@@ -489,7 +489,7 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
489489 ipsc = IPSubnetCalc ( Constants . defaultIP)
490490 }
491491 if ( sender. indexOfSelectedItem != - 1 ) {
492- ipsc!. maskBits = 30 - sender. indexOfSelectedItem ( )
492+ ipsc!. maskBits = 31 - sender. indexOfSelectedItem ( )
493493 self . doIPSubnetCalc ( )
494494 }
495495 else {
@@ -699,7 +699,7 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
699699 ipsc = IPSubnetCalc ( Constants . defaultIP)
700700 }
701701 if ( sender. indexOfSelectedItem != - 1 ) {
702- if ( ( 32 - sender. indexOfSelectedItem) < 32 ) {
702+ if ( ( 32 - sender. indexOfSelectedItem) <= 32 ) {
703703 doCIDR ( maskbits: ( 32 - sender. indexOfSelectedItem) )
704704 }
705705 else {
@@ -793,15 +793,15 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
793793 {
794794 subnetMaskCombo. removeAllItems ( )
795795 if ( wildcard. state == NSControl . StateValue. on) {
796- for index in ( 2 ... 24 ) . reversed ( ) {
796+ for index in ( 0 ... 24 ) . reversed ( ) {
797797 subnetMaskCombo. addItem ( withObjectValue: IPSubnetCalc . digitize ( ipAddress: ~ ( IPSubnetCalc . Constants. addr32Full << index) ) )
798798 }
799799 if ( ipsc != nil ) {
800800 subnetMaskCombo. selectItem ( withObjectValue: ipsc!. wildcardMask ( ) )
801801 }
802802 }
803803 else {
804- for index in ( 2 ... 24 ) . reversed ( ) {
804+ for index in ( 0 ... 24 ) . reversed ( ) {
805805 subnetMaskCombo. addItem ( withObjectValue: IPSubnetCalc . digitize ( ipAddress: ( IPSubnetCalc . Constants. addr32Full << index) ) )
806806 }
807807 if ( ipsc != nil ) {
0 commit comments