@@ -131,10 +131,7 @@ def emitterConverter(sizePar, data):
131
131
if x == "1" :
132
132
contBO += 1
133
133
contLoop += 1
134
- if contBO % 2 == 0 :
135
- parity .append (0 )
136
- else :
137
- parity .append (1 )
134
+ parity .append (contBO % 2 )
138
135
139
136
qtdBP += 1
140
137
@@ -168,12 +165,9 @@ def receptorConverter(sizePar, data):
168
165
for x in range (1 , len (data ) + 1 ):
169
166
# Performs a template of bit positions - who should be given,
170
167
# and who should be parity
171
- if qtdBP < sizePar :
172
- if (np .log (x ) / np .log (2 )).is_integer ():
173
- dataOutGab .append ("P" )
174
- qtdBP = qtdBP + 1
175
- else :
176
- dataOutGab .append ("D" )
168
+ if qtdBP < sizePar and (np .log (x ) / np .log (2 )).is_integer ():
169
+ dataOutGab .append ("P" )
170
+ qtdBP = qtdBP + 1
177
171
else :
178
172
dataOutGab .append ("D" )
179
173
@@ -201,12 +195,9 @@ def receptorConverter(sizePar, data):
201
195
for x in range (1 , sizePar + len (dataOutput ) + 1 ):
202
196
# Performs a template position of bits - who should be given,
203
197
# and who should be parity
204
- if qtdBP < sizePar :
205
- if (np .log (x ) / np .log (2 )).is_integer ():
206
- dataOutGab .append ("P" )
207
- qtdBP = qtdBP + 1
208
- else :
209
- dataOutGab .append ("D" )
198
+ if qtdBP < sizePar and (np .log (x ) / np .log (2 )).is_integer ():
199
+ dataOutGab .append ("P" )
200
+ qtdBP = qtdBP + 1
210
201
else :
211
202
dataOutGab .append ("D" )
212
203
@@ -230,14 +221,10 @@ def receptorConverter(sizePar, data):
230
221
aux = (binPos [contLoop ])[- 1 * (bp )]
231
222
except IndexError :
232
223
aux = "0"
233
- if aux == "1" :
234
- if x == "1" :
235
- contBO += 1
224
+ if aux == "1" and x == "1" :
225
+ contBO += 1
236
226
contLoop += 1
237
- if contBO % 2 == 0 :
238
- parity .append ("0" )
239
- else :
240
- parity .append ("1" )
227
+ parity .append (str (contBO % 2 ))
241
228
242
229
qtdBP += 1
243
230
@@ -250,11 +237,7 @@ def receptorConverter(sizePar, data):
250
237
else :
251
238
dataOut .append (dataOrd [x ])
252
239
253
- if parityReceived == parity :
254
- ack = True
255
- else :
256
- ack = False
257
-
240
+ ack = parityReceived == parity
258
241
return dataOutput , ack
259
242
260
243
0 commit comments